您的位置:首页 > 产品设计 > UI/UE

UIView、UIResponder、UIAlertView、UIActionSheet

2016-03-12 18:12 423 查看

code

通用

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
[_window release];
ViewController *vc = [[ViewController alloc] init];
self.window.rootViewController = vc;
[vc release];
return YES;
}
- (void)dealloc
{
[_window release];
[super dealloc];
}


UINavigationController的通用代码

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[self.window makeKeyAndVisible];
[_window release];
ViewController *vc = [[ViewController alloc] init];
UINavigationController *naVC = [[UINavigationController alloc] initWithRootViewController:vc];
self.window.rootViewController = naVC;
[naVC release];
[vc release];
return YES;
}

- (void)dealloc
{
[_window release];
[super dealloc];
}


UIView

动画

// 从原来的位置移到新的位置,与原来的大小没有关系

[UIView animateWithDuration:5.5 animations:^{
myView.frame = CGRectMake(50, 50, 70, 70);
}];


property

hidden

self.automaticallyAdjustsScrollViewInsets
是ViewController的属性,作用于第一个滚动视图,默认YES,作用就是让滚动视图自动去适应尺寸


UIAlertView

UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"提醒" message:@"鼠标点击了" delegate:self cancelButtonTitle:@"好的" otherButtonTitles:@"哈哈", nil];
myAlertView.alertViewStyle = UIAlertViewStyleSecureTextInput;
[myAlertView show];
[myAlertView release];


UIActionSheet

UIActionSheet *myActionSheet = [[UIActionSheet alloc] initWithTitle:@"Actions" delegate:self  cancelButtonTitle:@"取消" destructiveButtonTitle:@"删除" otherButtonTitles:@"猜", nil];
myActionSheet.myActionSheetStyle = UIActionSheetStyleDefault;
[myActionSheet showInView: self.view];
[myActionSheet release];


UIResponder

Method

resignFirstResponder

becomeFirstResponder

ViewController初始化顺序

-(id)initWithNibName:bundle:

-(void)loadView

-(void)viewDidLoad

-(void)viewWillAppear, viewDidAppear, viewWillDisappear, viewDidDisappear
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: