반응형

https://wikidocs.net/book/7059

 

NestJS로 배우는 백엔드 프로그래밍

> # 📝 책 구성을 리뉴얼했습니다. 추가된 챕터와 내용이 많이 있으니 참고하세요. 📝 ## 기획 의도 NestJS는 국내에서도 점점 인기를 얻어 모두싸인, 당근마켓 ...

wikidocs.net

 

반응형

'메모' 카테고리의 다른 글

AppStore에 보이는 항목  (0) 2022.05.06
번역기 사이트 추천  (0) 2022.05.02
Decodeable ????????????????????????????????????  (0) 2022.03.21
Git: Sourcetree에서 커밋이 안된다.  (0) 2022.02.07
RIBs  (0) 2021.12.28

사용자 루트 폴더에서의

zprofile 수정으로 명령이 먹히지 않는다.

재 부팅에도 똑같고 그렇다고 기본터미널이 아닌 다른 터미널 사용하기도 싫다

터미널의 프로파일 설정 란 에서 해당하는 명령어를 쳐주면 동작하나 이것도 마음에 들지 않아 방법을 찾아보던중 

아래 주소의 파일을 수정해 주면 깔끔히 동작하는걸 찾았다.

 

/etc/zshrc 

# Default prompt
 항목 밑을 아래같이 수정해주면

PS1="%1~ %# "

 이렇게 깔끔히 폴더명만 나오게된다.

 

이전에 이 내용의 글을 쓴적이 있는것같은데 보이지 않아 다시 작성.

반응형

scrollView를 받고있는 collectionView는 베이스와 같이 스크롤을 프로그래밍으로 움직이는게 가능하다

이를 간편하게 만들어둔게 scrollToItem( at,at, animated )

간편해서 

indexPath만 따로 만들어두면 곧장 해당 아이템이 있는곳으로 날아갈수있다.

 

iOS 15 시뮬레이터에서 돌려보던중 해당 기능이 동작하지 않는걸 발견했는데 도저히 이유를 모르겠던중 아래와같은 답변을 찾았다

https://developer.apple.com/forums/thread/663156

 

UICollectionView scrollToItem brok… | Apple Developer Forums

Hi All Where we have to put this code? self.collectionView.isPagingEnabled = false self.collectionView.scrollToItem(at: indexPath, at: .left, animated: false) self.collectionView.isPagingEnabled = true In my scenario, Let's suppose there are 5 items to sho

developer.apple.com

 

iOS14에서 나온 문제건만..

iOS15에서도 고쳐지지 않았다

 

문제가된 경우는

scolltoITem하기전 isPgingEnabled가 true로 설정해둘경우이다

그래서 

아래와같이 하면된다.

item번호 11번으로 가는 코드이다.

collectionView.isPagingEnabled = false
collectionView.scrollToItem(at: IndexPath(item: 11, section: 0), at: .centeredHorizontally, animated: true)
collectionView.isPagingEnabled = true

scrollToITem내부 파라미터에대해서는 공식 홈페이지를 보시고...

해당 함수를 호출하기전 paging을 꺼둔다.

그리고 다시킨다

 

어처구니없는 해결방법이지만 동작을 잘해서 그냥 해당방법으로 가기로 결정했다.

 

반응형

오랜만에 포스트를 남겨야지하다가 이건 남겨도 괜찮겠다 싶어서 남깁니다.

func moneyPlaceHolder(money: Int) -> String {
    guard money >= 0 else { return "" }
    
    let moneyString = String(money)
    let moneyCount = moneyString.count
    let insertPlaceCount = 3
    
    if moneyCount <= insertPlaceCount {
        return moneyString
    }
    
    let index0: String.Index = moneyString.startIndex
    var resultString = ""
    var loopIndex = 0
    for i in (0 ..< moneyCount).reversed() {
        resultString += String(moneyString[moneyString.index(index0, offsetBy: i)])
        loopIndex += 1
        if loopIndex >= insertPlaceCount {
            resultString += ","
            loopIndex = 0
        }
    }
    return String(resultString.reversed())
}

테스트 값:

print(moneyPlaceHolder(money: 1355500))
print(moneyPlaceHolder(money: 500))
print(moneyPlaceHolder(money: 1500))
print(moneyPlaceHolder(money: 034))
print(moneyPlaceHolder(money: 65))
print(moneyPlaceHolder(money: 0))
print(moneyPlaceHolder(money: 1))
print(moneyPlaceHolder(money: -30))

/**
  result
  1,355,500
  500
  1,500
  34
  65
  0
  1
  
*/

더 짧거나 효율좋게 할 수 있는 방법이 있으면 좋겠네요.

 

 

 

https://gist.github.com/wiwi-git/646b628dec8a7ed940c3d0cc885017fd

 

돈자리수표시.swift

GitHub Gist: instantly share code, notes, and snippets.

gist.github.com

반응형

 

기본 베이스는

 

https://reactnative.dev/docs/native-components-android#imageview-example

로 만들어서 

이미지 다운로드 부분은 

https://www.coderzheaven.com/2018/08/10/how-to-create-a-custom-native-imageview-in-android-for-reactnative/

 

를 이용하여 만들어봤다.

 

돌아는가게됏다...

 

안드로이드를 전혀 모르니 항상 뭔가 하려면 막혀서 힘들다


 

https://github.com/wiwi-git/ReactNativeUseAndroidUi

 

GitHub - wiwi-git/ReactNativeUseAndroidUi: rn에서 안드로이드에서 만든 ui가져오는 튜토리얼

rn에서 안드로이드에서 만든 ui가져오는 튜토리얼. Contribute to wiwi-git/ReactNativeUseAndroidUi development by creating an account on GitHub.

github.com

 

이후 웹뷰를 연결할거라 오픈이라 적힌 버튼이 있으나 중요한건 아니니 무시.

 

 

반응형

'React Native' 카테고리의 다른 글

rn fcm messaging error code 번역  (0) 2023.04.26
굳이 jsx를 사용하고싶다.  (0) 2022.01.05
UI Test를 위해 Detox를 적용해본다. -iOS  (0) 2021.12.15
npm install을 주의하라  (0) 2021.10.22
npm version downgrade  (0) 2021.07.12

패스워드용 텍스트필드를 만들려면 Secure설정을 주면 된다.

 

하지만 이렇게 하면 포커스가 옴겨졌다 다시 텍스트필드를 수정하려고하면 기존 텍스트 내용이 날라간다.

 

보안이 필요한 텍스트필드니 당연하다 생각했는데

 

이걸 원치 않는 사람이 있나보다

 

수정되는 이전 값이 남아 있고, 값이 숨기고 보이고 할 수 있고 그런 텍스트 필드를 원하는데 어떻게 해야할까요?

 

라는 질문을 글을 보고 이렇게 하면 되지 않을까 하고 해봤는데

 

솔직히 별로 맘에 안든다.

 

다른 방법이 없으려나

 

보안이 보안답지 않고....

그렇다고 소스가 깔끔하지도 않고....

 

나중에 텍스트필드를 새로 클래스 만들어서 하면 좀 깔끔해질거같긴한데 

미묘하다.

 

 

https://github.com/wiwi-git/Hide_And_Show_TextField

 

GitHub - wiwi-git/Hide_And_Show_TextField: 포커스 옴겨도 사라지지 않고 숨기고 보이고 할 수 있는 패스워

포커스 옴겨도 사라지지 않고 숨기고 보이고 할 수 있는 패스워드용 텍스트필드가 어떻게 만들까 생각하다 끄적여보는 레포지토리 - GitHub - wiwi-git/Hide_And_Show_TextField: 포커스 옴겨도 사라지지 않

github.com

 

var textField: UITextField!
    var showButton: UIButton!
    private var hiddenText: String = "" {
        didSet{
            print("hiddenText: " + hiddenText)
        }
    }
    var isShowMode = false
    
    let secretChar = "*"
    
    override func viewDidLoad() {
        super.viewDidLoad()
        textField = createTextField()
        showButton = createShowButton()

        view.addSubview(textField)
        view.addSubview(showButton)
        
        let viewGuide = view.safeAreaLayoutGuide
        textField.translatesAutoresizingMaskIntoConstraints = false
        showButton.translatesAutoresizingMaskIntoConstraints = false
        [
            textField.topAnchor.constraint(equalTo: viewGuide.topAnchor, constant: 30),
            textField.leadingAnchor.constraint(equalTo: viewGuide.leadingAnchor, constant: 16),
            textField.trailingAnchor.constraint(equalTo: viewGuide.trailingAnchor,constant: -16),
            textField.heightAnchor.constraint(equalToConstant: textField.frame.height),
            
            showButton.topAnchor.constraint(equalTo: textField.bottomAnchor, constant: 8),
            showButton.trailingAnchor.constraint(equalTo: viewGuide.trailingAnchor,constant: -16),
            showButton.heightAnchor.constraint(equalToConstant: textField.frame.height),
            showButton.widthAnchor.constraint(equalToConstant: 100)
        ].forEach { $0.isActive = true }
    }
    
    func createTextField() -> UITextField {
        let textFieldSize = CGSize(width: 0, height: 35)
        let textField = UITextField(frame: CGRect(origin: .zero, size: textFieldSize))
        textField.layer.borderWidth = 1
        textField.layer.cornerRadius = 10
        textField.textContentType = .password
        textField.placeholder = "password"
        textField.keyboardType = .asciiCapable
        textField.isSelected = false
        
        textField.addTarget(self, action: #selector(textFieldEditingChangedAction(_:)), for: .editingChanged)
        return textField
    }

    func createShowButton() -> UIButton {
        let showButton = UIButton(frame: CGRect(origin: .zero, size: CGSize(width: 100, height: 35)))
        showButton.setTitle("Set Show", for: .normal)
        showButton.setTitleColor(.systemBlue, for: .normal)
        showButton.backgroundColor = .clear
        showButton.setBackgroundImage(nil, for: .normal)
        showButton.layer.borderWidth = 1
        showButton.layer.borderColor = UIColor.systemBlue.cgColor
        showButton.layer.cornerRadius = 10
        showButton.addTarget(self, action: #selector(showButtonAction(_:)), for: .touchUpInside)
        
        return showButton
    }
    
    @objc func showButtonAction(_ sender: UIButton) {
        if ( sender.titleLabel?.text == "Set Show") {
            self.isShowMode = true
            sender.setTitle("Set Hide", for: .normal)
            sender.layer.borderColor = UIColor.clear.cgColor
            sender.backgroundColor = .darkGray
            sender.setTitleColor(.white, for: .normal)
            
            self.textField.text = hiddenText
            
        } else {
            self.isShowMode = false
            sender.setTitle("Set Show", for: .normal)
            sender.setTitleColor(.systemBlue, for: .normal)
            sender.backgroundColor = .clear
            sender.layer.borderColor = UIColor.systemBlue.cgColor
            
            textField.text = ""
            hiddenText.forEach { _ in
                textField.text! += secretChar
            }
        }
    }
    
    @objc func textFieldEditingChangedAction(_ textField: UITextField) {
        guard let last = textField.text?.last else {
            hiddenText = ""
            return
        }
        
        if textField.text?.count ?? 0 > hiddenText.count {
            if (!isShowMode) {
                textField.text?.removeLast()
                textField.text! += secretChar
            }
            hiddenText += String(last)
        } else {
            hiddenText.removeLast()
        }
    }
반응형

+ Recent posts