ios学习笔记

原创 2012年03月21日 09:32:30

What is a bundle, you ask? Well, a bundle is just a special type of folder whose contents
follow a specific structure. Applications and frameworks are both bundles, and this call
returns a bundle object that represents our application.
One of the primary uses of NSBundle is to get to resources that you added to the
Resources folder of your project.
Those files will be copied into your application’s
bundle when you build your application. We’ve added resources like images to our
projects, but up to now, we’ve used those only in Interface Builder. If we want to get to
those resources in our code, we usually need to use NSBundle. We use the main bundle
to retrieve the URL of the resource in which we’re interested.

 

NSURL *plistURL = [bundle URLForResource:@"statedictionary"
withExtension:@"plist"];

This will return a URL containing the location of the statedictionary.plist file.

 

// image for ios

The first thing we do is load six different images. We do this using a convenience
method on the UIImage class called imageNamed:.
UIImage *seven = [UIImage imageNamed:@"seven.png"];
UIImage *bar = [UIImage imageNamed:@"bar.png"];
UIImage *crown = [UIImage imageNamed:@"crown.png"];
UIImage *cherry = [UIImage imageNamed:@"cherry.png"];

 

Once we have the six images loaded, we then need to create instances of UIImageView,
one for each image, for each of the five picker components. We do that in a loop.
for (int i = 1; i <= 5; i++) {
UIImageView *sevenView = [[UIImageView alloc] initWithImage:seven];
UIImageView *barView = [[UIImageView alloc] initWithImage:bar];
UIImageView *crownView = [[UIImageView alloc] initWithImage:crown];
UIImageView *cherryView = [[UIImageView alloc]
initWithImage:cherry];
UIImageView *lemonView = [[UIImageView alloc] initWithImage:lemon];
UIImageView *appleView = [[UIImageView alloc] initWithImage:apple];
After we have the image views, we put them into an array. This array is the one that will
be used to provide data to the picker for one of its five components.
NSArray *imageViewArray = [[NSArray alloc] initWithObjects:
sevenView, barView, crownView, cherryView,
lemonView, appleView, nil];

xamarin学习笔记B04(ios的xib)

  • 2017年12月03日 17:34
  • 50.98MB
  • 下载

xamarin学习笔记B07(ios的UITableView)

  • 2017年12月16日 15:23
  • 378.3MB
  • 下载

ios学习笔记(一)Windows7上使用VMWare搭建iPhone开发环境

我们都知道开发iPhone等ios平台的移动应用时需要使用Mac本,但是Mac本都比较昂贵,所以我们可以采用Windows7上利用VMWare安装Mac操作系统的方法来模拟ios开发环境,达到降低成本...

xamarin学习笔记B05(ios的UIScrollView)

  • 2017年12月08日 16:08
  • 235.93MB
  • 下载

xamarin学习笔记B03(ios的UIView的了解)

  • 2017年12月02日 14:17
  • 396.86MB
  • 下载

iOS RTMP直播推流学习笔记 & VideoCore源码梳理

直播整个流程大体是这样的: 采集(视频/音频)-> 处理(美颜/滤镜)-> 编码 -> 封包 -> 推流 -> 转码 -> 拉流 -> 解码/渲染/播放 VideoCore是著名的RTMP推流...

xamarin学习笔记A01下(ios环境的安装)

  • 2017年05月14日 19:27
  • 55.64MB
  • 下载

黑马程序员——IOS学习笔记(C语言字符串和数组)

-----------android培训、java培训、IOS学习型技术博客、期待与您交流!------------ 数组: 数组在C语言中有着特殊的地位,它有很多特性,例如它的存储是...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:ios学习笔记
举报原因:
原因补充:

(最多只允许输入30个字)