GithubHelp home page GithubHelp logo

networksocketprogrammingwithswiftbsd's Issues

[Feat] 회원가입 시 선 o vs 선 x

회원가입 시 선이 있는 경우 vs 없는 경우를 찍어봤습니다. ( 지금 아직 살짝 구현만 해본 것입니다.)

왼쪽은 선이 없는경우, 오른쪽은 선이 있는 경우였습니다.

[Feat] SoTalk 메인 화면 텍스트 필드 클릭시 input accessoryview 등록

// 텍스트 필드에 input accessory view 추가하는 방법 티스토리 포스트

화면

텍스트 필드 선언 코드

private let textField = UITextField().set {
$0.translatesAutoresizingMaskIntoConstraints = false
$0.font = .systemFont(ofSize: Constant.TextField.size)
$0.textColor = Constant.TextField.textColor
let comment = "그룹 이름을 검색하세요."
let placeholderAttrStr = NSMutableAttributedString(
string: comment)
let attributes: [NSAttributedString.Key: Any] = [
.foregroundColor: Constant.TextField.placeholderColor,
.font: UIFont.systemFont(ofSize: Constant.TextField.size)]
placeholderAttrStr.addAttributes(
attributes,
range: NSRange(location: 0, length: comment.count))
$0.attributedPlaceholder = placeholderAttrStr
}

텍스트 필드 input accessory view의 버튼 선언 코드

https://github.com/SHcommit/NetworkSocketProgrammingWithSwiftBsd/blob/8cf0f90a8ea14b7318c1cd50427130dcc5eddcb2/SoTalk/Source/Feature/Chat/View/GroupChatSearch.swift#LL53C1-L53C1

텍스트 필드 input accessory view용 인스턴스로 컨테이너 뷰 생성 + 버튼 auto layout으로 등록 + UITextFieldDelegate

func initInputAccessoryView() {
// constant
let height: CGFloat = 75.0
let origin: CGPoint = .init(x: 0, y: -300)
let size: CGSize = .init(
width: UIScreen.main.bounds.width,
height: height)
let containerView = UIView(
frame: CGRect(origin: origin, size: size))
textField.inputAccessoryView = containerView
}
var accessoryView: UIView? {
textField.inputAccessoryView
}
func setInputAccessoryViewWithButton() {
searchButton.setInputAccessoryViewLayout(
from: accessoryView,
spacing: .init(leading: 24, trailing: 24))
}
func hideKeyboard() {
textField.resignFirstResponder()
}
}
extension GroupChatSearch: UITextFieldDelegate {
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
textField.resignFirstResponder()
}
func textFieldDidEndEditing(_ textField: UITextField) {
textField.resignFirstResponder()
}
}

텍스트 필드 이외의 화면 클릭시 텍스트 필드 first responder 해제

override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesBegan(touches, with: event)
guard let touch = touches.first else { return }
let touchLocation = touch.location(in: self.view)
if !naviBottomView.searchBarView.frame.contains(touchLocation) {
naviBottomView.hideKeyboard()
}
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.