前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >ios开发基础知识 - 1

ios开发基础知识 - 1

作者头像
用户1172164
发布2018-01-16 12:03:59
6210
发布2018-01-16 12:03:59
举报
文章被收录于专栏:我和未来有约会

输出

command+shift+r

代码语言:javascript
复制
NSLog(@"log: %@ ", myString); 
NSLog(@"log: %f ", myFloat); 
NSLog(@"log: %i ", myInt);

显示图片

代码语言:javascript
复制
CGRect myImageRect = CGRectMake(0.0f, 0.0f, 320.0f, 100.0f); 
UIImageView *myImage = [[UIImageView alloc] initWithFrame:myImageRect]; 
[myImage setImage:[UIImage imageNamed:@"myImage.png"]]; 
[self.view addSubview:myImage]; 
[myImage release];

app frame 大小

代码语言:javascript
复制
CGRect bounds = [[UIScreen mainScreen] bounds];
CGRect frame = [UIScreen mainScreen].applicationFrame;

浏览器控件

代码语言:javascript
复制
CGRect webFrame = CGRectMake(0.0, 0.0, 320.0, 480.0);
UIWebView *webView = [[UIWebView alloc] initWithFrame:webFrame];
[webView setBackgroundColor:[UIColor clearColor]];
NSString *urlAddress = @"http://nasa.cnblogs.com";
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[webView loadRequest:requestObj];
[self addSubview:webView];
[webView release];

在状态栏显示网络状态

代码语言:javascript
复制
UIApplication* app = [UIApplication sharedApplication];
app.networkActivityIndicatorVisible = YES; 

播放序列动画

代码语言:javascript
复制
NSArray *myImages = [NSArray arrayWithObjects:
					 [UIImage imageNamed:@"myImage1.png"],
					 [UIImage imageNamed:@"myImage2.png"],
					 [UIImage imageNamed:@"myImage3.png"],
					 [UIImage imageNamed:@"myImage4.gif"],
					 nil];

UIImageView *myAnimatedView = [UIImageView alloc];
[myAnimatedView initWithFrame:[self bounds]];
myAnimatedView.animationImages = myImages;
myAnimatedView.animationDuration = 0.25; // 秒
myAnimatedView.animationRepeatCount = 0; // 0 = 无限
[myAnimatedView startAnimating];
[self addSubview:myAnimatedView];
[myAnimatedView release];

提示筐

代码语言:javascript
复制
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"Alert!"          
						delegate:self cancelButtonTitle:@"OK" 
									  otherButtonTitles:nil];
[alert show];
[alert release];
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2011-01-13 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档