【小(xiǎo)編推薦】ios 代碼添加控件(jiàn)

2015-01-15 &nbs ∑₩₽p; |  &nbΩα✔ sp;發布者:梁國(guó)芳  &n<© bsp;|   查看(kàn):3320次σ∑ ♥

ios
 

#import "AppDelegate.h"

 

@interface AppDelegate ()

 

@end

 

@implementation AppDelegate

 

 

- (void)dealloc{

 

    [_window release];

    [super   dealloc];

}

 

CGRect rect;

 

CGSize size ;

CGFloat width;

CGFloat height;

UIColor * liangColor;

- (BOOL)application:(UIApplication *)application didFinishLaunchin♣&gWithOptions:(NSDictionary *)launchOptions {

    // Override point for customizati¶$on after application ₽♦launch.

    

    

    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];

    // Override point fo​××r customization after α‌βλapplication launch.

    self.window.backgroundColor = [UIColor  redColor];

    [self.window makeKeyAndVisible];

    

    

    

    

   rect = [[UIScreen mainScreen] bounds];

    size = rect.size;

    width = size.width;

    height = size.height;

    

    liangColor = [UIColor colorWithRed:20/255.0 green:240/255.0 blue:240/255.0 alpha:1];

 

 

    

    

    

    

    NSLog(@"屏幕的(de)寬度是(shì)%f,屏幕的(de)高(gāo)度是(shì)%f",width,height);

    UIButton* button2 =[[UIButton   alloc]init];

    

    button2☆φ.frame=CGRectMake((width-100)/2,height-100,100,50);

    

    button2≥↔↕♥.backgroundColor =   liangColor;

    

    [button2 setTitle:@"提交"forState:UIControlStateNormal];

    

    [button2→ £♥ setTitleColor:[UIColor  purpleColor]forState:UIControlStateNormal];

    [self.window  addSubview:button2];

    

    

 

    return YES;

}