1

I am trying to increase Font size when Device change to iPad from iPhone. but there is no effect when i run into iPad. I am Using .XIB.

Here is my Setting.

1) I have Enable Size Classes.

enter image description here

2) I have set wAny/hAny in Storyboard.

enter image description here

3) I have set wR/hR in Font storyboard.

enter image description here

Constrain for Continue Label.

enter image description here

but when i run it into iPad there is no effect in Fontsize in iPad.

Please guide me where i am doing mistake.

Application is based on Landscape Mode

Edit :-

enter image description here

Badal Shah
  • 7,541
  • 2
  • 30
  • 65
  • This is a size class bug. Custom fonts do not work with size classes. – Bhavin Bhadani Apr 26 '16 at 08:15
  • i have tried to get solution but looks like there is issue in size class with custom `fonts`. With `System fonts` its working fine. For solution you can change `Font` with `Manual Coding`. – Abhishek Sharma Apr 26 '16 at 14:04

2 Answers2

0

You are setting font size for w R and h R that means when you textfield opens in ipad then it consider this font size because it is override ipad portrait mode. So, if you remove this then it will take w any h any.

w any h any only called when you are not override it. for example you are making universal app and you set constraint for w any h any and w compact h regular (for all iphone in portrait) then when your app open in iphone portrait it takes setups of w compact h regular and run in ipad then it takes setup of w any h any because you haven't explicitly override size class for ipad portrait. likewise if you are only giving constraints for w any h any then both take this size class. so in short first it is find that is there any overridden size class for specific mode. if it is not then by default it use any any size class.

Hope this will help :)

Ketan Parmar
  • 27,092
  • 9
  • 50
  • 75
  • Thanks for the replay friend then what is the solution how can i set in landscape mode ? – Badal Shah Apr 26 '16 at 07:19
  • RR means ? regular height regular width ? one more thing i have notice that it will not work with custom font ? – Badal Shah Apr 26 '16 at 07:26
  • yes, regular height regular width. I don't ever try with custom font so i don't have much idea about that – Ketan Parmar Apr 26 '16 at 07:27
  • I have already set Regular height / Regular height please check in above image . – Badal Shah Apr 26 '16 at 07:30
  • then it should work if ipad in both orientation. your font size should be 55.0 in both orientation in ipad. why are you setting font for wAny hC ? – Ketan Parmar Apr 26 '16 at 07:35
  • i have set just it for testing purpose . because it dosent work in RR. – Badal Shah Apr 26 '16 at 08:05
  • remove than and just keep RR only. and make sure that you have given proper constraints for RR and installed it. – Ketan Parmar Apr 26 '16 at 08:07
  • i have tested it with removing . can you please check this once i think problem with custom font. http://stackoverflow.com/questions/26166737/custom-font-sizing-in-xcode6-size-classes-not-working-properly-w-custom-fonts – Badal Shah Apr 26 '16 at 08:09
  • I have check in my demo by changing font to custom. i have kept `Cochin` font for both RR and AA with diiferent size like 10 and 30. it works fine. in ipad it's displays 30 and in iphone its displays 10 font size – Ketan Parmar Apr 26 '16 at 08:19
  • don't know i have tried a lot to changing font but can't. – Badal Shah Apr 26 '16 at 08:50
  • I think there is another mistake in constrains or else. try to change font family to `Helvetica` and then check what happen – Ketan Parmar Apr 26 '16 at 09:17
  • yes if i change it to helvetika then it works fine . – Badal Shah Apr 26 '16 at 09:22
  • from where you are getting this `CarterOne` font? – Ketan Parmar Apr 26 '16 at 09:23
  • from our designer. i have set it in .plist. – Badal Shah Apr 26 '16 at 09:24
  • I think if you put custom fonts outside from library then it should not work with font size. are you able to increase this font's size without using size class? have you check that? take two label sent this custom font and give different size. don't override any size class only just keep any any and check font size is changeable? – Ketan Parmar Apr 26 '16 at 09:48
0

When you're using universal storyboards, each text-displaying control in a storyboard will now have a small + icon to the left of the font setting in the Attributes Inspector. If you click it, It will allow you to set different values for different size classes.

I hope, it will help you.

Anuj J
  • 186
  • 1
  • 11
  • thanks for the replay but i have already done this all setting but i am not able to get desire output in ipad. – Badal Shah Apr 26 '16 at 08:06
  • What do u want in ipad exactly? – Anuj J Apr 26 '16 at 09:13
  • I need textsize change according to device. if device is iphone then, textsize will 20 and if ipad then textsize will be 55. – Badal Shah Apr 26 '16 at 09:14
  • Frist find size of screen: CGRect screenSize = [[UIScreen mainScreen] bounds]; CGFloat screenWidth = screenSize.width; Then set the font size as a percentage of the screen size: CGFloat fontScreenPercentage = 0.05f; UIFont *myFont = [UIFont systemFontOfSize:(fontScreenPercentage * screenWidth)] – Anuj J Apr 26 '16 at 09:16
  • I need to change it from storyboard. – Badal Shah Apr 26 '16 at 09:20
  • Review this link http://stackoverflow.com/questions/25085923/font-size-on-universal-storyboard – Anuj J Apr 26 '16 at 09:23