Friday 16 January 2015

HOW TO SET IOS UI ELEMENTS FRAME WITH PERCENTAGE VALUES TO SUPPORT ALL IOS DEVICES WITH SINGLE FRAME(SINGLE LINE CODE)



HOW TO SET IOS UI ELEMENTS FRAME WITH PERCENTAGE VALUES TO SUPPORT ALL IOS DEVICES

WITH SINGLE FRAME(SINGLE LINE CODE)


* Set your user interface elements frame according to your device screen resolution percentage.
* you don't need to set separate frames for iphone 4,5,6,6+,ipad,ipad2,ipad mini.
* Set Single frame with percentage to support in all iOS devices.
Download the library files and sample code from the following URL:

USAGE:
1.Drag RKFrame.h and RKFrame.m files into your project
2.Import RKFrame.h file in .pch file or import in your view controller
3.set frame with x-position percentage,y-position percentage,width percentage,height percentage and pass you superview frame ,Please check Example

Example :
UIButton *rkFrameButton=[[UIButton alloc]initWithFrame:[RKFrame XpositionPercentage:25.0 YpositionPercentage:25.0 widthPercentage:50.0 heightPercentage:50 view:self.view.frame]];
UIView *view=[[UIView alloc] initWithFrame:[RKFrame XpositionPercentage:25 YpositionPercentage:80 widthPercentage:50 heightPercentage:15 view:self.view.frame]];
UIView *view1=[[UIView alloc] initWithFrame:[RKFrame XpositionPercentage:25 YpositionPercentage:25 widthPercentage:50 heightPercentage:50 view:view.frame]];

Run your project in all iOS Devices and check


Thank you

     RK