摘要: 1.contentSize 属性//简单创建UIScrollViewUIImage *imageToLoad = [UIImage imageNamed:@"MacBookAir.png"]; self.myImageView = [[UIImageView alloc] initWithImage... 阅读全文
posted @ 2014-10-16 09:41 safiri 阅读(116) 评论(0) 推荐(0) 编辑
摘要: Objective-C 中 #import 和 #include 的区别预编译指令Objective-C:#importC,C++:#include#import由gcc编译器支持在 Objective-C 中,#import 被当成 #include 指令的改良版本来使用。除此之外,#import... 阅读全文
posted @ 2014-10-15 17:01 safiri 阅读(432) 评论(0) 推荐(0) 编辑
摘要: 以图片的实际宽和高显示在屏幕上。UIImage *macBookAir = [UIImage imageNamed:@"MacBookAir.png"]; //initWithImage:self.myImageView = [[UIImageView alloc] initWithImage:ma... 阅读全文
posted @ 2014-10-14 09:52 safiri 阅读(132) 评论(0) 推荐(0) 编辑
摘要: - (void) buttonIsPressed:(UIButton *)paramSender{ NSLog(@"Button is pressed.");}- (void) buttonIsTapped:(UIButton *)paramSender{ NSLog(@"Button is tap... 阅读全文
posted @ 2014-10-14 09:40 safiri 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 问题:使用 UITextView 显示多行文本创建一个简单的TextView:- (void)viewDidLoad{[super viewDidLoad];self.view.backgroundColor = [UIColor whiteColor];self.myTextView = [[UI... 阅读全文
posted @ 2014-10-13 16:06 safiri 阅读(726) 评论(0) 推荐(0) 编辑
摘要: 代码:1.简单地添加了一个textFieldCGRect textFieldFrame = CGRectMake(0, 0, 200, 31); _myTextField = [[UITextField alloc]initWithFrame:textFieldFrame]; _myTe... 阅读全文
posted @ 2014-10-13 14:30 safiri 阅读(305) 评论(0) 推荐(0) 编辑
摘要: 常用属性:numberOfLines =0时自动换行myLabel.adjustsFontSizeToFitWidth = YESmyLabel.font = [UIFont boldSystemFontOfSize:14.0f];shadowColor 这个属性是 UIColor 类型,如属性... 阅读全文
posted @ 2014-10-13 13:41 safiri 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 假设有两个视图控制器,它们的分别为 FirstViewController 和 SecondViewControlller。 现在到 app delegate 中定义视图控制器和标签栏。代码如下:.h:#import #import "FirstViewController.h"#import "S... 阅读全文
posted @ 2014-10-13 11:32 safiri 阅读(385) 评论(0) 推荐(0) 编辑
摘要: 问题:希望将按钮添加到导航栏中1.导航栏属于 UINavigationBar 类,你可以再任何时候创建它,并将它添加到任意的 view 中。2.创建一个导航按钮,须要做一下工作: 创建一个 UIBarButtonItem 实例。 使用视图控制器的 navigationItem 属性将按钮添加到视... 阅读全文
posted @ 2014-10-13 09:44 safiri 阅读(594) 评论(0) 推荐(0) 编辑
摘要: 问题:在导航控制器的当前视图中的标题中用一张图片代替文本使用导航项目中视图控制器中 navigation item 的 titleView 属性:- (void)viewDidLoad{[super viewDidLoad];self.view.backgroundColor = [UIColor ... 阅读全文
posted @ 2014-10-11 13:59 safiri 阅读(315) 评论(0) 推荐(0) 编辑