NSBundle,UIImage,UIButton的使用

1.NSBundle

1> 一个NSBundle代表一个文件夹,利用NSBundle能访问对应的文件夹

2> 利用mainBundle就可以访问软件资源包中的任何资源

3> 案例:

        // File : 全路径
        // NSBundle : 一个NSBundle代表一个文件夹

        // 利用mainBundle就可以访问软件资源包中的任何资源
        NSBundle *bundle = [NSBundle mainBundle];
        
        //  获得imageData.plist的全路径
        NSString *path = [bundle pathForResource:@"imageData" ofType:@"plist"];
            

 

 

3> 模拟器应用程序的安装路径

/Users/Star/资源库/Application Support/iPhone Simulator/7.1/Applications

注:资源库文件夹为隐藏文件夹

如需显示隐藏文件夹,请打开终端,输入以下命令即可

显示:defaults write com.apple.finder AppleShowAllFiles -bool true
隐藏:defaults write com.apple.finder AppleShowAllFiles -bool false

 

2.UIImageView和UIButton

1> 使用场合

* UIImageView: 如果仅仅是显示图片,不需要监听图片的点击

* UIButton: 既要显示图片,又要监听图片的点击

 

2> 相同点:能显示图片

 

3> 不同点:

* UIButton能处理点击事件, UIImageView不能处理点击事件

* UIButton既能显示图片, 又能显示文字

* UIButton能同时显示两张图片

* UIButton继承自UIControl, 默认能处理事件

* UIImageView继承自UIView, 默认不能处理事件,当然还有其他方法可以处理

 

3.Xcode文档安装路径

/Applications/Xcode.app/Contents/Developer/Documentation/DocSets

 

4.Xcode模拟器安装路径

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs

posted @ 2015-03-05 23:10  星星Star😋  阅读(227)  评论(0编辑  收藏  举报