Chinaunix首页 | 论坛 | 博客
  • 博客访问: 124850
  • 博文数量: 19
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 300
  • 用 户 组: 普通用户
  • 注册时间: 2014-06-01 16:26
个人简介

我穷的什么都没有了,只有梦想!

文章分类

全部博文(19)

文章存档

2014年(19)

我的朋友

分类: iOS平台

2014-06-06 21:03:58

新建文件AppDelegate 点 m文件
h 文件在下面 

#import "AppDelegate.h"


@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

{

    //产生一个window对象 使用个屏幕大小一样。

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

    // Override point for customization after application launch.

    //更改颜色[UIColor yellowColor];

    self.window.backgroundColor = [UIColor grayColor];

    //让window显示出来  把xindow对象设置为window,并且可见

    [self.window makeKeyAndVisible];

    

    //建立一个uiview对象


    //1.建立uiview对象  uivies通过cgrect结构体 确定 位置大

    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(100, 120, 200, 25)];

    //2.对view进行设置

    [view setBackgroundColor:[UIColor blackColor]];

    

//    view.center = CGPointMake(10, 40);//改变中心

    

    //视图的属性设置

    //透明度

    view.alpha  = 0.3;

    

    //隐藏不显示

    

//    view.hidden = YES;//yes 隐藏。no为显示

    

    view.tag = 10000;//设置view的tag值(zuoy:方便父视图快速定位子视图)

    

    

    //3.将view对象 添加到window上

    [self.window addSubview:view];

    NSLog(@"%@", view.superview);//获取view的父视图

    

    //通过tag寻找子视图

//    UIView *viewTemp = [self.window viewWithTag:10000];


    

    //4.将view释放

    [view release];


//    UIView *uns = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 100, 300) ];

//    [uns setBackgroundColor:[UIColor blackColor]];

//    

//    

//    [self.window addSubview:uns];

//

//    UIView *cao = [[UIView alloc] initWithFrame:CGRectMake(50, 80, 40, 30)];

//    [cao setBackgroundColor:[UIColor orangeColor]];

//    

//    [uns addSubview:cao];

//    

    

   return YES;

}


- (void)applicationWillResignActive:(UIApplication *)application

{

    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.

    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.

}


- (void)applicationDidEnterBackground:(UIApplication *)application

{

    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 

    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.

}


- (void)applicationWillEnterForeground:(UIApplication *)application

{

    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.

}


- (void)applicationDidBecomeActive:(UIApplication *)application

{

    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.

}


- (void)applicationWillTerminate:(UIApplication *)application

{

    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.

}


@end

从此单位开始 h 文件 

#import


@interface AppDelegate : UIResponder


@property (strong, nonatomic) UIWindow *window;



//uiview继承了所有属性


@end




阅读(1469) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~