ios,swift2020. 1. 30. 10:33

[ios]swift dynamic height cell site

 

cell text size 를 체크 하는 방법 

 

https://www.youtube.com/watch?v=TEMUOaamcDA

Posted by thdeodls85
ios,swift2020. 1. 30. 10:33

[ios] example site

 

https://iosexample.com/

Posted by thdeodls85
ios,swift2020. 1. 30. 10:30

[ios]swift textfield 직접 입력하기

 

 

 func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {

 if let text : String = (textField.text as NSString?)?.replacingCharacters(in: range, with: string) as String?

            {

print("text -> \(text)")

            }

 

return false

}

 

return false처리하고... replacingCharacters 등록 시키면 text를 구할 수 있다.. 직접 넣으면 된다.. 

Posted by thdeodls85
ios,swift2020. 1. 30. 10:25

[ios]swift imageView tag UITapGestureRecognizer 설정방법

 

imageView에 tag 세팅하고.. 

 

UITapGestureRecognizer 에 등록 할 시??

 

#selector(clickTest(_:)

 

 

@objc func clickTest(_ sender: UITapGestureRecognizer)

    {

        if let imageView = sender.view as? UIImageView

        {

            print("sender -> \(imageView.tag)")

        }

    }

'ios,swift' 카테고리의 다른 글

[ios] example site  (0) 2020.01.30
[ios] swift textfield 직접 입력하기  (0) 2020.01.30
[ios] uiview child view hide 방법  (0) 2020.01.30
[ios] swift scrollview scroll가능하게  (0) 2020.01.30
[ios] swift percent 보여주는 방법  (0) 2020.01.30
Posted by thdeodls85
ios,swift2020. 1. 30. 10:24

[ios] uiview child view hide 방법

 

uiview를 hide하지만 child 가 사라지지 않는다...??

 

그러면 uiview에서 clip to Bounds = yes

Posted by thdeodls85
ios,swift2020. 1. 30. 10:23

[ios]swift scrollview scroll가능하게

 

중요한건... scrollview안의 uiview의 height 를 1000 -> 250으로 내려야 한다. 

 

https://www.youtube.com/watch?v=nfHBCQ3c4Mg

Posted by thdeodls85
ios,swift2020. 1. 30. 10:22

[ios]swift percent 보여주는 방법

 

static func getDiscount(target : Int , compare : Int) -> Int

    {

        if target >= compare

        {

            return 0

        }

        

        let result = (((compare - target) * 100) / compare)

        

        return result

    }

Posted by thdeodls85
ios,swift2020. 1. 30. 10:17

[ios]swift comma만드는 방법

 

숫자를 가격으로 나오게 comma로 만들려면 어떻게 해야 할까??

 

 static func getComma(price : Int) -> String

    {

        let formatter = NumberFormatter()

        formatter.locale = NSLocale.current

        formatter.numberStyle = NumberFormatter.Style.decimal

        formatter.usesGroupingSeparator = true

        

        return formatter.string(from: price as NSNumber) ?? ""

    }

Posted by thdeodls85