로그인이라고하는 버튼이 있습니다. 단추 글꼴 및 크기를 볼 수 있지만 단추 글꼴 크기를 볼 때 모든 장치에서 동일하게 보입니다. 어떻게 다른 장치에 대한 다른 글꼴 크기를 정의?. 나는 아이폰 초상화에 대해서만 이야기하고있다. 그래서 크기 클래스로 솔루션을 제공하지 마십시오.다른 장치의 다른 글꼴 크기를 UIButton으로 설정하십시오.
0
A
답변
0
0
iPhone 장치 크기를 확인한 다음 if-else 루프에서 단추 글꼴 크기 논리를 적용 할 수 있습니다.
#define iPhoneVersion ([[UIScreen mainScreen] bounds].size.height == 568 ? 5 : ([[UIScreen mainScreen] bounds].size.height == 480 ? 4 : ([[UIScreen mainScreen] bounds].size.height == 667 ? 6 : ([[UIScreen mainScreen] bounds].size.height == 736 ? 7 : ([[UIScreen mainScreen] bounds].size.height == 736 ? 61 : ([[UIScreen mainScreen] bounds].size.height == 736 ? 61 : (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 10 :61)))))))
if (iPhoneVersion == 4)
{
mybutton.titleLabel.font = [UIFont systemFontOfSize:12];
}
else if (iPhoneVersion == 5)
{
mybutton.titleLabel.font = [UIFont systemFontOfSize:14];
}
else if (iPhoneVersion == 6)
{
mybutton.titleLabel.font = [UIFont systemFontOfSize:16];
}
else if (iPhoneVersion == 7)
{
mybutton.titleLabel.font = [UIFont systemFontOfSize:17];
}
및 모든 장치가 동일합니다.
0
이
if UIScreen.mainScreen().bounds.size.height == 480 {
// iPhone 4
mybutton.titleLabel.font = mybutton.titleLabel.font.fontWithSize(20)
} else if UIScreen.mainScreen().bounds.size.height == 568 {
// IPhone 5
mybutton.titleLabel.fontt = mybutton.titleLabel.font.fontWithSize(20)
} else if UIScreen.mainScreen().bounds.size.width == 375 {
// iPhone 6
mybutton.titleLabel.font = mybutton.titleLabel.font.fontWithSize(20)
} else if UIScreen.mainScreen().bounds.size.width == 414 {
// iPhone 6+
mybutton.titleLabel.font = mybutton.titleLabel.font.fontWithSize(20)
} else if UIScreen.mainScreen().bounds.size.width == 768 {
// iPad
mybutton.titleLabel.font = mybutton.titleLabel.font.fontWithSize(20)
}
관련 문제
- 1. 다른 iPhone 장치의 자동 변경 글꼴 크기
- 2. 다른 글꼴 모음에서 글꼴 크기를 표준화하는 방법
- 3. UIButton으로 다른 앱을 엽니 다.
- 4. 속성이 지정된 텍스트를 UIButton으로 설정하십시오.
- 5. WPF 글꼴 크기를 화면 크기에 따라 설정하십시오.
- 6. 다른 장치의 이미지 크기
- 7. UIPickerView에서 다른 글꼴 크기를 선택 하시겠습니까?
- 8. 다른 글꼴 유형을 사용하는 UILabel의 크기를 계산하십시오.
- 9. 다른 화면에서 같은 글꼴 크기를 얻는 비율
- 10. RTF 제어에서 기본 글꼴/텍스트 크기를 설정하십시오.
- 11. 다른 UIView에서 UIButton으로 어떻게 전달할 수 있습니까?
- 12. 동일한 페이지에서 다른 글꼴에 대해 다른 글꼴 크기를 사용합니까?
- 13. 동일한 CSS가 다른 페이지에서 다른 글꼴 크기를 생성합니다.
- 14. 다른 장치에서 프로그래밍 방식으로 글꼴 크기를 조정하는 방법 (Xamarin.android)?
- 15. C# 런타임에서 콘솔 글꼴 및 글꼴 크기를 설정하십시오.
- 16. Swift에서 더하기 장치의 글꼴 및 크기를 늘리는 방법은 무엇입니까?
- 17. 다른 장치의 상대 레이아웃
- 18. 장치의 방향을 unity3d로 설정하십시오.
- 19. AutoLayout 및 iOS가있는 다른 장치의 크기를 조정하려면 UICollectionViewCell을 사용하십시오.
- 20. 다른 운영체제에 다른 글꼴 지정
- 21. 다른 장치의 다른 HTML 페이지 간의 통신
- 22. JFreeChart 다른 글꼴 또는 제목의 글꼴 크기
- 23. 프로그래밍 방식으로 안드로이드 장치의 글꼴 크기를 변경하는 방법은 무엇입니까?
- 24. 장치의 방향에 관계없이 UIButton의 글꼴 크기를 자동으로 설정하는 방법은 무엇입니까?
- 25. tinymce-rails가 기본적으로 다른 글꼴 모음을 사용하도록 설정하십시오.
- 26. 다른 글꼴 크기의 다른 단락을 단락으로 단락
- 27. SpriteKit에서 다른 화면 크기를 지원합니다.
- 28. 같은 필드의 다른 글꼴 크기
- 29. 너비에 맞게 사용할 때 여러 UIButton의 글꼴 크기를 동일하게 설정하십시오.
- 30. sIFR : 다른 글꼴 크기 렌더링
는이에 대한 사이즈 클래스를 사용할 수 있습니다보십시오. – KKRocks
다른 장치의 [단일 크기 클래스 내의 다른 글꼴 크기] [iOS의 가능한 복제본] (http://stackoverflow.com/questions/28076020/ios-different-font-sizes-within-single-size-class-for-different- 장치) – KKRocks