iOS 6 to iOS 7 Transition

Ios7 screen

After having done 50 percent of the transition of my app “Boutiquiee” to iOS 7, I am starting to consider dropping support for iOS 6 and iOS 5. It is an early beta, so maybe it is smart to wait a little longer with conclusions, but I do not think that most things I encountered where bugs. To give you an example, to get the height of an UITextView one could always use

  [myTextView sizeToFit];

and then use the contentSize, which was pretty painless. The new font handling in iOS 7 gives you the possibility to change the text size, which therefore seems to make things more complicated. For iOS 7 I ended up using this

  UIFont *font = [myTextView font];
  int width = myTextView.frame.size.width, height = myTextView.frame.size.height;

  myTextView.contentInset = UIEdgeInsetsMake(-8, -4, 0, 0);

  NSMutableDictionary *atts = [[NSMutableDictionary alloc] init];
  [atts setObject:font forKey:NSFontAttributeName];

  CGRect rect = [text boundingRectWithSize:CGSizeMake(width, height)
                                               options:NSStringDrawingUsesLineFragmentOrigin
                                            attributes:atts
                                               context:nil];


  CGRect frame = myTextView.frame;
  frame.size.height = description_height = rect.size.height + 4;
  myTextView.frame = frame;

Shop profile

Update 08/28/13: Seems to still be an issue in Beta 6 since there is an active discussion in the Apple Dev-Forum. I do not know where the EdgeInset difference comes from.. Guess it is being fixed in the next beta version.

Furthermore views are now generally full-screen, which is cool, but as far as I found out there is no clean solution to keep all versions working properly, only by determining the iOS version at runtime. To say it again, it is only an early beta, so it is a little bit early to tell, but if it stays that way there might not be many other good options as to drop support for everything prior to iOS7. For me as a one man enterprise, it absolutely makes sense to drop support for iOS 6, because the past showed that the adoption to new iOS versions happens fast and I do not want to maintain conditional code and I could avoid that in the past.

I am curios about the next beta releases and will maybe update my experiences in this article.

Comments