Skip to content

Instantly share code, notes, and snippets.

View Haeuncs's full-sized avatar
🐹
✧ʕ̢̣̣̣̣̩̩̩̩·͡˔·ོɁ̡̣̣̣̣̩̩̩̩✧ʕ̢̣̣̣̣̩̩̩̩·͡˔·ོɁ̡̣̣̣̣̩̩̩̩✧ʕ̢̣̣̣̣̩̩̩̩·͡˔·ོɁ̡̣̣̣̣̩̩̩̩✧

Haeun Lee Haeuncs

🐹
✧ʕ̢̣̣̣̣̩̩̩̩·͡˔·ོɁ̡̣̣̣̣̩̩̩̩✧ʕ̢̣̣̣̣̩̩̩̩·͡˔·ོɁ̡̣̣̣̣̩̩̩̩✧ʕ̢̣̣̣̣̩̩̩̩·͡˔·ོɁ̡̣̣̣̣̩̩̩̩✧
View GitHub Profile
import UIKit
class CenteredTextView: UITextView {
override init(frame: CGRect, textContainer: NSTextContainer?) {
super.init(frame: frame, textContainer: textContainer)
setup()
}
required init?(coder: NSCoder) {
super.init(coder: coder)
@Haeuncs
Haeuncs / ViewController.swift
Last active December 13, 2019 10:35
Scroll view moving to the center of a specific Button
//
// ViewController.swift
// ButtonsAnimate
//
// Created by LEE HAEUN on 2019/12/12.
// Copyright © 2019 LEE HAEUN. All rights reserved.
//
//코드 설명
//submit 버튼을 누르면 scrollview가 false인 버튼을 찾아서 그 중앙으로 이동하는 소스
@Haeuncs
Haeuncs / scrollViewHeight.swift
Created October 9, 2019 06:25
scrollView InsideView Height
//
// ViewController.swift
// testProj
//
// Created by LEE HAEUN on 09/10/2019.
// Copyright © 2019 LEE HAEUN. All rights reserved.
//
import UIKit
@Haeuncs
Haeuncs / SettingNoticeViewController.swift
Created August 8, 2019 05:23
Notice ViewController With custom LargeTitle
import Foundation
import SnapKit
import RxSwift
import RxCocoa
/// 공지사항 뷰컨트롤러
class SettingNoticeViewController: UIViewController {
let disposeBag = DisposeBag()
let viewModel = SettingAnnounceViewModel()
@Haeuncs
Haeuncs / TableViewBackGroundView.swift
Last active August 9, 2019 01:27
UITableView Custom BackGoundView
//
// TableViewBackgroundView.swift
// Fitco
//
// Created by OOPSLA on 25/05/2019.
// Copyright © 2019 Cho. All rights reserved.
//
import Foundation
class tableViewBackGroundView: UIView {
@Haeuncs
Haeuncs / LoadingViewWithImageViewScaleTransform.swift
Created August 1, 2019 06:22
ImageView scale transform when loading in swift
class LoadingViewWithLogo: NSObject {
private static let shared = LoadingViewWithLogo()
private var backView: UIView?
private var fitcoLogoImageView: UIImageView?
private override init() { }
static func show() {
let backView = UIView(frame: .zero)
backView.backgroundColor = UIColor.black.withAlphaComponent(0.4)
extension UIImage {
func resized(toWidth width: CGFloat) -> UIImage? {
let canvasSize = CGSize(width: width, height: CGFloat(ceil(width/size.width * size.height)))
UIGraphicsBeginImageContextWithOptions(canvasSize, false, scale)
defer { UIGraphicsEndImageContext() }
draw(in: CGRect(origin: .zero, size: canvasSize))
return UIGraphicsGetImageFromCurrentImageContext()
}
func resizedImageWith(targetSize: CGSize) -> UIImage {
let imageSize = self.size
@Haeuncs
Haeuncs / DateFormat.swift
Created August 1, 2019 01:01
Swift String to Date format
import UIKit
var str = "Hello, playground"
var date = "20190801"
let formatter = DateFormatter()
formatter.dateFormat = "yyyyMMdd"
formatter.date(from: date)
formatter.string(from: Date())
@Haeuncs
Haeuncs / UIImageFixedOrientationExtension.swift
Created July 19, 2019 05:02 — forked from schickling/UIImageFixedOrientationExtension.swift
Extension to fix orientation of an UIImage (Sets orientation to portrait)
extension UIImage {
func fixedOrientation() -> UIImage {
if imageOrientation == UIImageOrientation.Up {
return self
}
var transform: CGAffineTransform = CGAffineTransformIdentity
//
// ViewController.swift
// testWeb
//
// Created by LEE HAEUN on 2019/07/18.
// Copyright © 2019 LEE HAEUN. All rights reserved.
//
import UIKit
import WebKit