iPhone SDK Examples(一)

以下均为使用到Xib文件,其中原因大家应当都知道,不再赘述。
1、显示图像Image View

   1. CGRect myImageRect = CGRectMake(0.0f, 0.0f, 320.0f, 109.0f);
   2. UIImageView *myImage = [[UIImageView alloc] initWithFrame:myImageRect];
   3. [myImage setImage:[UIImage imageNamed:@"myImage.png"]];
   4. myImage.opaque = YES; // 设置不透明度
   5. [self.view addSubview:myImage];
   6. [myImage release];

 

2、Web view

   1. CGRect webFrame = CGRectMake(0.0, 0.0, 320.0, 460.0);
   2. UIWebView *webView = [[UIWebView alloc] initWithFrame:webFrame];
   3. [webView setBackgroundColor:[UIColor whiteColor]];
   4. NSString *urlAddress = @"http://www.google.com";
   5. NSURL *url = [NSURL URLWithString:urlAddress];
   6. NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
   7. [webView loadRequest:requestObj];
   8. [self addSubview:webView];
   9. [webView release];

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值