Draft-Nine lattice

Source: Internet
Author: User

#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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.