退回输入键盘:自定义颜色:隐藏状态栏:
来源:互联网 发布:em算法 高斯混合模型 编辑:程序博客网 时间:2024/04/28 08:01
退回输入键盘:
-(BOOL) textFieldShouldReturn:(id)textField{
[textField resignFirstResponder];
}
CGRect
CGRect frame = CGRectMake (origin.x, origin.y, size.width, size.height);矩形
NSStringFromCGRect(someCG) 把CGRect结构转变为格式化字符串;
CGRectFromString(aString) 由字符串恢复出矩形;
CGRectInset(aRect) 创建较小或较大的矩形(中心点相同),+较小 -较大
CGRectIntersectsRect(rect1, rect2) 判断两矩形是否交叉,是否重叠
CGRectZero 高度和宽度为零的/位于(0,0)的矩形常量
CGPoint & CGSize
CGPoint aPoint = CGPointMake(x, y); CGSize aSize = CGSizeMake(width, height);
设置透明度 [myView setAlpha:value]; (0.0 < value < 1.0)
设置背景色 [myView setBackgroundColor:[UIColor redColor]];
(blackColor;darkGrayColor;lightGrayColor;whiteColor;grayColor;redColor;greenColor;blueColor;cyanColor;yellowColor;magentaColor;
orangeColor;purpleColor;brownColor; clearColor; )
自定义颜色:
UIColor *newColor = [[UIColor alloc] initWithRed:(float) green:(float) blue:(float) alpha:(float)]; 0.0~1.0
320X480 480X320 状态栏高 20 像素高 导航栏 工具栏 44像素高
隐藏状态栏:
[[UIApplication shareApplication] setStatusBarHidden: YES animated:NO]
横屏:
[[UIApplication shareApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight].
orientation == UIInterfaceOrientationLandscapeLeft
window=[[UIWindow alloc] initWithFrame:[UIScreen mainScreen] bounds];全屏
自动适应父视图大小:
aView.autoresizingSubviews = YES;
aView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
定义按钮
UIButton *scaleUpButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[scaleUpButton setTitle:@"放 大" forState:UIControlStateNormal];
scaleUpButton.frame =CGRectMake(40,420, 100, 40);
[scaleUpButton addTarget:self action:@selector(scaleUp)forControlEvents:UIControlEventTouchUpInside];
设置视图背景图片
UIImageView *aView;
[aView setImage:[UIImage imageNamed:@”name.png”]];
view1.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"image1.png"]];
UISlider *slider = (UISlider *) sender;
NSString *newText = [[NSString alloc] initWithFormat:@”%d”, (int)(slider.value + 0.5f)];
label.text = newText;
活动表单 <UIActionSheetDelegate>
- (IBActive) someButtonPressed:(id) sender
{
UIActionSheet *actionSheet = [[UIActionSheet alloc]
initWithTitle:@”Are you sure?”
delegate:self
cancelButtonTitle:@”No way!”
destructiveButtonTitle:@”Yes, I’m Sure!”
otherButtonTitles:nil];
[actionSheet showInView:self.view];
[actionSheet release];
}
警告视图 <UIAlertViewDelegate>
- (void) actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger) buttonIndex
{
if(buttonIndex != [actionSheet cancelButtonIndex])
{
NSString *message = [[NSString alloc] initWithFormat:@”You can
breathe easy, everything went OK.”];
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@”Something was done”
message:message
delegate:self
cancelButtonTitle:@”OK”
otherButtonTitles:nil];
[alert show];
[alert release];
[message release];
}
}
动画效果
-(void)doChange:(id)sender
{
if(view2 ==nil)
{
[self loadSec];
}
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1];
[UIView setAnimationTransition:([view1 superview]?UIViewAnimationTransitionFlipFromLeft:UIViewAnimationTransitionFlipFromRight)forView:self.view cache:YES];
if([view1 superview]!=nil)
{
[view1 removeFromSuperview];
[self.view addSubview:view2];
}else {
[view2 removeFromSuperview];
[self.view addSubview:view1];
}
[UIView commitAnimations];
}
-(BOOL) textFieldShouldReturn:(id)textField{
[textField resignFirstResponder];
}
CGRect
CGRect frame = CGRectMake (origin.x, origin.y, size.width, size.height);矩形
NSStringFromCGRect(someCG) 把CGRect结构转变为格式化字符串;
CGRectFromString(aString) 由字符串恢复出矩形;
CGRectInset(aRect) 创建较小或较大的矩形(中心点相同),+较小 -较大
CGRectIntersectsRect(rect1, rect2) 判断两矩形是否交叉,是否重叠
CGRectZero 高度和宽度为零的/位于(0,0)的矩形常量
CGPoint & CGSize
CGPoint aPoint = CGPointMake(x, y); CGSize aSize = CGSizeMake(width, height);
设置透明度 [myView setAlpha:value]; (0.0 < value < 1.0)
设置背景色 [myView setBackgroundColor:[UIColor redColor]];
(blackColor;darkGrayColor;lightGrayColor;whiteColor;grayColor;redColor;greenColor;blueColor;cyanColor;yellowColor;magentaColor;
orangeColor;purpleColor;brownColor; clearColor; )
自定义颜色:
UIColor *newColor = [[UIColor alloc] initWithRed:(float) green:(float) blue:(float) alpha:(float)]; 0.0~1.0
320X480 480X320 状态栏高 20 像素高 导航栏 工具栏 44像素高
隐藏状态栏:
[[UIApplication shareApplication] setStatusBarHidden: YES animated:NO]
横屏:
[[UIApplication shareApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight].
orientation == UIInterfaceOrientationLandscapeLeft
window=[[UIWindow alloc] initWithFrame:[UIScreen mainScreen] bounds];全屏
自动适应父视图大小:
aView.autoresizingSubviews = YES;
aView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
定义按钮
UIButton *scaleUpButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[scaleUpButton setTitle:@"放 大" forState:UIControlStateNormal];
scaleUpButton.frame =CGRectMake(40,420, 100, 40);
[scaleUpButton addTarget:self action:@selector(scaleUp)forControlEvents:UIControlEventTouchUpInside];
设置视图背景图片
UIImageView *aView;
[aView setImage:[UIImage imageNamed:@”name.png”]];
view1.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"image1.png"]];
UISlider *slider = (UISlider *) sender;
NSString *newText = [[NSString alloc] initWithFormat:@”%d”, (int)(slider.value + 0.5f)];
label.text = newText;
活动表单 <UIActionSheetDelegate>
- (IBActive) someButtonPressed:(id) sender
{
UIActionSheet *actionSheet = [[UIActionSheet alloc]
initWithTitle:@”Are you sure?”
delegate:self
cancelButtonTitle:@”No way!”
destructiveButtonTitle:@”Yes, I’m Sure!”
otherButtonTitles:nil];
[actionSheet showInView:self.view];
[actionSheet release];
}
警告视图 <UIAlertViewDelegate>
- (void) actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger) buttonIndex
{
if(buttonIndex != [actionSheet cancelButtonIndex])
{
NSString *message = [[NSString alloc] initWithFormat:@”You can
breathe easy, everything went OK.”];
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@”Something was done”
message:message
delegate:self
cancelButtonTitle:@”OK”
otherButtonTitles:nil];
[alert show];
[alert release];
[message release];
}
}
动画效果
-(void)doChange:(id)sender
{
if(view2 ==nil)
{
[self loadSec];
}
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1];
[UIView setAnimationTransition:([view1 superview]?UIViewAnimationTransitionFlipFromLeft:UIViewAnimationTransitionFlipFromRight)forView:self.view cache:YES];
if([view1 superview]!=nil)
{
[view1 removeFromSuperview];
[self.view addSubview:view2];
}else {
[view2 removeFromSuperview];
[self.view addSubview:view1];
}
[UIView commitAnimations];
}
- 退回输入键盘:自定义颜色:隐藏状态栏:
- iPhone开发笔记 退回输入键盘:自定义颜色:隐藏状态栏:
- iPhone开发笔记 退回输入键盘:自定义颜色:隐藏状态栏:
- iphone开发笔记(-) 退回输入键盘:自定义颜色:隐藏状态栏:
- android自定义状态栏颜色
- 自定义状态栏颜色
- Android自定义状态栏颜色
- android 自定义状态栏颜色
- Android自定义状态栏颜色
- Android自定义状态栏颜色
- 自定义状态栏的颜色
- IOS改变状态栏颜色以及隐藏状态栏
- IOS_改变状态栏颜色 隐藏状态栏
- 隐藏输入键盘
- iOS开发中 修改状态栏颜色 或者隐藏状态栏颜色
- Android自定义状态栏颜色、状态栏透明
- Android 状态栏透明、自定义状态栏颜色设置
- android 自定义顶部状态栏颜色
- ORA-10456: cannot open standby database; media recovery session may be in progress
- Android中将布局文件/View添加至窗口过程分析 ---- 从setContentView()谈起
- ARM Instructions
- 一种奇特的DEDE隐藏后门办法(dedecms漏洞90sec.php文件)
- nginx做负载CDN加速获取端真实ip
- 退回输入键盘:自定义颜色:隐藏状态栏:
- oracle模糊查询:全文索引方式(三)
- cortex-M3 GNU开发环境搭建
- a标签用jquery的attr添加onclick方法无效的解决
- linux cmdline解析过程说明
- 30天自制OS笔记(二)10~20天内容中遇到的问题
- Google tile和TMS的索引算法
- oracle模糊查询:分区局部全文索引方式(四)
- 纵横找单词【2014年雅虎研究院校园招聘笔试题目之一】