iphone 开发笔记退回输入键盘- (BOOL) textFieldShouldReturn:(id)textField{ [textField resignFirstResponder]; } CGRect CGRect frame = CGRectMake (, , , ) ;矩形 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]; ( < value < ) 设置背景色[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)]; ~ 竖屏 320X480 横屏 480X320 状态栏高( 显示时间和网络状态) 20 像素导航栏、工具栏高( 返回) 44 像素隐藏状态栏[[UIApplication shareApplication] setStatusBarHidden: YES animated:NO] 横屏[[UIApplication shareApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight]. 屏幕变动检测 orientation == UIInterfaceOrientationLandscapeLeft 全屏 window=[[UIWindow alloc] initWithFrame:[UIScreen mainScreen] bounds]; 自动适应父视图大小: = YES; = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); 定义按钮 UIButton *scaleUpButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; [scaleUpButton setTitle:@" 放大" forState:UIControlStateNormal]; = CGRectMake(40, 420, 100, 40); [scaleUpButton addTarget:self action:***@selector(scaleUp) forControlEvents:UIControlEventTouchUpInside]; 设置视图背景图片 UIImageView *aView; [aView setImage:[UIImage imageNamed:@ ” ”]]; = [UIColor colorWithPatternImage: [UIImage imageNamed:@""]]; 自定义 UISlider 的样式和滑块我们使用的是 UISlider 的 setMinimumTrackImage ,和 setMaximumTrackImage 方法来定义图片的, 这两个方法可以设置滑块左边和右边的图片的, 不过如果用的是
ios开发笔记 来自淘豆网m.daumloan.com转载请标明出处.