본문 바로가기

개발73

UILabel 안에 아이콘 넣기 let attachment = NSTextAttachment() attachment.image = UIImage(named: "yourIcon.png") let attachmentString = NSAttributedString(attachment: attachment) let myString = NSMutableAttributedString(string: price) myString.appendAttributedString(attachmentString) label.attributedText = myString 2016. 11. 18.
String의 부분 속성 바꾸기 : NSMutableAttribueString String의 부분 부분 속성을 바꾸고 싶다면! let attributedString = NSMutableAttributedString(string: "총 12 건")attributedString.addAttribute(NSForegroundColorAttributeName, value: UIColor.rgba(123, 124, 125, 255), range: NSRange(location: 0, length: 1))attributedString.addAttribute(NSForegroundColorAttributeName, value: UIColor.rgba(123, 124, 125, 255), range: NSRange(location: attributedString.length - 1 , lengt.. 2016. 10. 24.
버튼 이벤트 다른 컨트롤러의 func 불러오기 기본적으로 버튼 이벤트를 호출할때vNewComics.btnMore.addTarget(self, action: #selector(onTabBarChange), for: .touchUpInside) 이런식으로 호출한다. 근데 다른 컨트롤러의 func를 호출한다면 vNewComics.btnMore.addTarget(nil, action: #selector(HomeVC().onTabBarChange), for: .touchUpInside) 이런식으로 해야 한다! self -> nil로!func 는 Controller().func으로! 2016. 10. 21.
UItableView 회전 tableviewName.transform = CGAffineTransform(rotationAngle: -(CGFloat)(M_PI_2)) 이런식으로 쓰면 된다 2016. 10. 14.
[Swift]UIGestureRecognizer 참고자료 http://minsone.github.io/mac/ios/uigesturerecognizer 참고하여 나는 이런식으로 썼다! override func viewDidLoad() { super.viewDidLoad() initUi() let swipeUp = UISwipeGestureRecognizer(target: self, action: #selector(self.didSwipe(swipeGes:))) let swipeDown = UISwipeGestureRecognizer(target: self, action: #selector(self.didSwipe(swipeGes:))) swipeUp.direction = .up swipeDown.direction = .down self.view.gestureR.. 2016. 9. 28.
반응형