Tuesday, December 31, 2013

ios7 frame problem.

Getting problem for setting frame for UIButton(Other controls) in ios7. In ios7 view controller using full layout as mentioned in iOS 7 UI Transition Guide (Here ios7 UI Transition Guide). 

if you want change the layout use edgesForExtendedLayout property.


The iOS 7 latest version brings quite a few changes in both design and functionality. As a developer i noticed that apps views would have shifted to the top while porting Apps from iOS6 to iOS7.

In iOS 7 view controllers by default take the full screen layout. Apple designed iOS 7 screens to extend from edge to edge so that the app content is discernible through translucent UI elements. So, this will allows users to view more data on the screen. 

To solve this issue we need to change the edge of the view controller by using the property edgesForExtendedLayout which is available only in iOS7.

 In your UIViewController add
                   self.edgesForExtendedLayout = UIRectEdgeNone;

Make sure to check system version, because edgesForExtendedLayout available in iOS7.
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7)
{
   self.edgesForExtendedLayout = UIRectEdgeNone;
}

Comparing the views after making this change, you’ll notice that your iOS 6 views show up as they were designed. If you are designing your App for iOS 7, highly recommend leveraging the full screen layout that Apple recommends.