#import "AppDelegate.h"
@interface Appdelegate ()
@property (Nonatomic,strong) Nsarray*app;
@end
@implementation Appdelegate
-(Nsarray *) app{
if (_app = = nil) {
Nsstring*path=[[nsbundle mainbundle]pathforresource:@ "App.plist" oftype:nil];
_app=[nsarray Arraywithcontentsoffile:path];
}
return _app;
}
-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchOptions {
Override point for customization after application launch.
Self.window = [[UIWindow alloc]initwithframe:[uiscreen mainscreen].bounds];
Self.window.backgroundColor = [Uicolor Whitecolor];
[Self.window makekeyandvisible];
int totalloc=4;
CGFloat appvieww=90;
CGFloat appviewh=90;
CGFloat margin= (SELF.WINDOW.FRAME.SIZE.WIDTH-TOTALLOC*APPVIEWW)/(totalloc+1);
for (int i=0; i<self.app.count; i++) {
NSLog (@ "= = =");
int row=i/totalloc;//line number
int loc=i%totalloc;//column number
CGFloat appviewx=margin+ (MARGIN+APPVIEWW) *loc;
CGFloat appviewy=margin+ (MARGIN+APPVIEWH) *row;
Creating UIView Controls
UIView *appview=[[uiview Alloc]initwithframe:cgrectmake (appviewx, Appviewy, APPVIEWW, APPVIEWH)];
[Appview Setbackgroundcolor:[uicolor Browncolor];
[Self.window Addsubview:appview];
Create text
Uibutton*appbutton=[uibutton Buttonwithtype:uibuttontypesystem];
Appbutton.frame=cgrectmake (0, 50, 80, 20);
[Appbutton Settitle:self.app[i] forstate:uicontrolstatenormal];
[Appbutton Settitlecolor:[uicolor Whitecolor] forstate:uicontrolstatehighlighted];
[Appview Addsubview:appbutton];
}
return YES;
}
Draft-Nine lattice