IOS 学习笔记
2011-10-27 22:02
369 查看
本来一直用BN记录笔记的,现在感觉查找的时候不怎么方便还是直接写在博客里面,随时随地可以查找。
日积月累,滴水穿石!
1:如何设置背景透明 lbl.backgroundColor=[UIColor clearColor];
2:如何设置UIViewControl的frame属性 myViewControl.view.frame = CGRectMake(0, 0, 320 , 100);
3:分别获得 CGRect中的4个属性值(view frame) view.frame.origin.x, frame.origin.y, frame.size.width, frame.size.height
4:如何用代码添加事件: [button addTarget:self action:@selector(buttonClicked) forControlEvents:UIControlEventTouchUpInside];
5: 设置UIButton的自定义样式风格: 在属性栏,选择Type=custon
6:OS4使用自定义动画,以及动画完成后自动调用方法
[UIView animateWithDuration:0.5 delay:0 options:UIViewAnimationTransitionCurlUp animations:^{ [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES]; // [delegate ContentView_UnLoad]; // self.view.center = CGPointMake(self.view.center.x, self.view.center.y+480.0); } completion:^(BOOL finished){ if (finished){ [self unLoadMe]; //[delegate ContentView_UnLoad]; } } ];
7:,当页面跳转时,使用系统自带动画:
//当前页 被跳转页
nContentView=[[UserNewsContentView alloc] initWithNibName:@"UserNewsContentView" bundle:nil SetTypeID:typeStr SetTitleID:titleStr]; [self presentModalViewController:nContentView animated:YES];
//跳转页
-(IBAction)btnContent_click:(id)sender{
[self dismissModalViewControllerAnimated:YES];
}
8:时间戳转换为日期:
NSDate* dat = [NSDate dateWithTimeIntervalSince1970:1319939453];
9:日期转换是星期几:NSDateComponents *weekdayComponents = [[NSCalendar currentCalendar] components:NSWeekdayCalendarUnit fromDate:dat]; int weekday = [weekdayComponents weekday]; NSLog(@"%d",weekday); NSLog(@"%@",dat);
10:请问 怎么查看一个view得superview? [view.superview description]
// [((AppDelegate *)[UIApplication sharedApplication].delegate).window.rootViewController dismissModalViewControllerAnimated:YES]; [((AppDelegate *)[UIApplication sharedApplication].delegate).menuViewController dismissModalViewControllerAnimated:YES]; //[self.presentingViewController.presentingViewController dismissModalViewControllerAnimated:NO];
11:
利用QuartzCore为UIView视图添加border以及圆角
2011年04月20日 星期三 16:26
12遍历一个View的子视图并且删除
for (UIView *oneView in ViewBody.subviews ) {
[oneView removeFromSuperview];
}
日积月累,滴水穿石!
1:如何设置背景透明 lbl.backgroundColor=[UIColor clearColor];
2:如何设置UIViewControl的frame属性 myViewControl.view.frame = CGRectMake(0, 0, 320 , 100);
3:分别获得 CGRect中的4个属性值(view frame) view.frame.origin.x, frame.origin.y, frame.size.width, frame.size.height
4:如何用代码添加事件: [button addTarget:self action:@selector(buttonClicked) forControlEvents:UIControlEventTouchUpInside];
5: 设置UIButton的自定义样式风格: 在属性栏,选择Type=custon
6:OS4使用自定义动画,以及动画完成后自动调用方法
[UIView animateWithDuration:0.5 delay:0 options:UIViewAnimationTransitionCurlUp animations:^{ [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES]; // [delegate ContentView_UnLoad]; // self.view.center = CGPointMake(self.view.center.x, self.view.center.y+480.0); } completion:^(BOOL finished){ if (finished){ [self unLoadMe]; //[delegate ContentView_UnLoad]; } } ];
7:,当页面跳转时,使用系统自带动画:
//当前页 被跳转页
nContentView=[[UserNewsContentView alloc] initWithNibName:@"UserNewsContentView" bundle:nil SetTypeID:typeStr SetTitleID:titleStr]; [self presentModalViewController:nContentView animated:YES];
//跳转页
-(IBAction)btnContent_click:(id)sender{
[self dismissModalViewControllerAnimated:YES];
}
8:时间戳转换为日期:
NSDate* dat = [NSDate dateWithTimeIntervalSince1970:1319939453];
9:日期转换是星期几:NSDateComponents *weekdayComponents = [[NSCalendar currentCalendar] components:NSWeekdayCalendarUnit fromDate:dat]; int weekday = [weekdayComponents weekday]; NSLog(@"%d",weekday); NSLog(@"%@",dat);
10:请问 怎么查看一个view得superview? [view.superview description]
// [((AppDelegate *)[UIApplication sharedApplication].delegate).window.rootViewController dismissModalViewControllerAnimated:YES]; [((AppDelegate *)[UIApplication sharedApplication].delegate).menuViewController dismissModalViewControllerAnimated:YES]; //[self.presentingViewController.presentingViewController dismissModalViewControllerAnimated:NO];
11:
利用QuartzCore为UIView视图添加border以及圆角
2011年04月20日 星期三 16:26
首先引入QuartzCore/QuartzCore.h到类中 然后如下使用: UITextView* yourTextView =[[UITextView alloc] initWithFrame:CGRectMake(0,200,200,100)]; [yourTextView.layer setBackgroundColor: [[UIColor whiteColor] CGColor]]; [yourTextView.layer setBorderColor:[[UIColor grayColor]CGColor]]; [yourTextView.layer setBorderWidth:1.0]; [yourTextView.layer setCornerRadius:8.0f]; [yourTextView.layer setMasksToBounds:YES]; |
for (UIView *oneView in ViewBody.subviews ) {
[oneView removeFromSuperview];
}
相关文章推荐
- iOS学习笔记-044.UIScrollView分页加强——连续滚动优化
- iOS学习笔记-049.UITabBarController
- IOS学习笔记28—SQLite3第三方库之FMDB
- iOS开发学习笔记 2-4 C语言部分 指针
- IOS学习笔记29—提示框第三方库之MBProgressHUD
- ios屏幕旋转学习笔记
- IOS Augmented Reality增强现实学习笔记 -基于位置
- IOS学习笔记---collections
- iOS学习笔记-103.多线程02——线程状态、同步、通信
- IOS学习笔记64--关于linker command failed with exit code错误
- IOS学习笔记23—多线程之NSThread、NSOperation、NSInvocationOperation
- IOS开发学习笔记(2)
- ios开发学习笔记(这里一定有你想要的东西,全部免费)
- iOS 多线程学习笔记 —— NSThread
- iOS学习笔记26-iOS中Cookie的使用和解析
- iOS学习笔记——麻麻再也不担心我不会算tableviewcell的行高了
- IOS学习笔记25—HTTP操作之ASIHTTPRequest(一)
- iOS学习笔记(八)——iOS网络通信http之NSURLConnection
- iOS学习笔记
- iOS学习笔记-018.舒尔特表游戏