Objective-C
czjuttsw
Learning, staying up to date, and working on the latest and greatest in languages and APIs is what keeps me excited.
展开
-
Objective-C 语言的一些新奇的东西
昨晚在图书馆找了N久,终于找到了唯一的一本Objective-C基础教程书。不过这也可以理解,由于iPhone在中国的普及,作为iPhone的编程语言Objective-C也随之受到中国程序员的关注,在TIOBE排行榜中,Obj-C已经跻身到第三名。很快,一晚上就看完了基础教程,无非就是讲解语言的历史背景和语法。Obj-C和C++语言很相似,都是面向对象,并且是单向继承的,也有自己的预编译。总原创 2013-03-09 23:26:14 · 1258 阅读 · 0 评论 -
Xcode的archive菜单选项是灰色的
如果当前Xcode选择的设备是模拟器,那么"Archive"是灰色的,不能点。把当前设备设置成连接的真机设备或者默认的"iOS Device","Archive"会变成黑色。原创 2015-04-21 16:35:30 · 22509 阅读 · 0 评论 -
获取iPhone或者iPad的UDID
1.连接iPhone或者iPad到电脑。2. 打开iTunes。3. 在Summary(概要)右边点击序列号,Serial Number会变成UDID(如果不是UDID,请继续点击)。4. command+c(MAC) 或者 Ctrl+c(Windows)复制UDID。5. 粘贴到你需要的地方。 (比如到Member Center的device里。)参考原创 2015-04-21 16:23:59 · 1853 阅读 · 0 评论 -
Xcode查看真机app沙盒内容
1. 打开Xcode2. 连接iPhone或者iPad3. 打开菜单Window-> Devices4. 在DEVICES选择连接的真机5. 在右侧的Installed Apps选择你要查看的app6. 点击下面的齿轮按钮,选择Download Container,保存到桌面,生成XXX.xcappdata文件7. 在桌面找到该文件,右键以包(package)的形式打开文件原创 2015-04-29 10:22:43 · 11173 阅读 · 0 评论 -
如何将Swift中的多参函数转化成Curring函数
假设我们有一个含有多个参数的函数,用于构建一个人的基本信息:func buildInfoWithName(name: String,#age: Int,#gender: String,#address: String,#phone: String) -> String { return "My name is " + name + ",I'm a " + g原创 2015-04-30 10:31:02 · 1224 阅读 · 0 评论 -
本地化app名字
How to Localize App NamesIt is possible to localize app names directly within Xcode and you do not need to create multiple versions of the same app. The great and wonderful InfoPlist.str转载 2015-05-07 13:56:16 · 2681 阅读 · 0 评论 -
如何在Swift中使用NSError
步骤一:声明NSError变量。一定要加"?",不加或者加"!"都不行。因为使用了optional,所以要用var而不用let。var error: NSError?步骤二:使用的时候在变量前加上"&"。NSJSONSerialization.JSONObjectWithData(data!, options: .MutableContainers, error: &error)之原创 2015-07-09 17:33:14 · 4658 阅读 · 0 评论 -
Storyboard Reference
在某些情况下,你开发的应用可能包含有各种各样的复杂界面,如果你使用Storyboard来管理这些界面,通常你会将这些界面按照相应的逻辑分成许多子模块,放在不同的storyboard里,比如注册相关的放到Register.Storyboard,图片相关的放到Photos.Storyboard,而主界面放到Main.Storbyoard。这么做的好处是不仅可以缩小每个storbyoard的打开速度,而原创 2015-06-12 23:01:30 · 2645 阅读 · 0 评论 -
UIImagePickerController本地化控件文字
在使用UIImagePickerController时候,你会发现在选择照片或者拍照的时候,界面的许多控件都是英文的,比如"Cancel","Choose"等。那么如何将它们本地化呢,比如替换成“取消”和“选取“?甚至你调用系统其它库(比如ALAssetsLibrary)返回的各种字符串都是英文的。解决这个的方案是往Info.plist里添加key/value。CFBundleDevelo原创 2015-07-04 10:10:37 · 3132 阅读 · 0 评论 -
Code Block Evaluation C Extension
GCC Code Block Evaluation C ExtensionLet's make this official: NSHipster's Objective-C trend of 2013 is code block evaluation assignment. Recommended by both Jim Kubicek and Maximilian Tagher (c转载 2015-09-23 23:37:22 · 1584 阅读 · 0 评论 -
iOS数字等宽字体
Helvetica Neue原创 2018-04-27 15:39:37 · 8989 阅读 · 0 评论 -
UIAlertView点击按钮不会销毁自身View
子类化UIAlertView,复写方法- (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated;/// UIAlertView subclass which can't be dismissed when buttons clicked.@interface Fix原创 2015-04-15 10:30:22 · 2203 阅读 · 0 评论 -
针对项目中部分文件开启或者关闭ARC
Making ARC and non-ARC files play nice togetherOctober 10, 2011 by Christopher SextonIf you want to exclude a file from being compiled with ARC you can do so by setting a flag on the .m file转载 2015-04-10 16:46:49 · 2252 阅读 · 1 评论 -
iOS 如何创建单例
// YOURCLASSNAME.h@interface YOURCLASSNAME : NSObject+(instancetype) sharedInstance;@end// YOURCLASSNAME.m@implementation YOURCLASSNAME+ (instancetype)sharedXXX { static YOURCLASSN原创 2014-09-20 15:52:25 · 1456 阅读 · 0 评论 -
App Store Review Guidlines
Apple DeveloperTechnologiesResourcesProgramsSupportMember CenterRecommended ResultsApp Store Review GuidelinesIntroductionWe're pleased that y转载 2014-10-30 23:55:49 · 2215 阅读 · 0 评论 -
iOS 8自定义动画转场上手指南
http://www.appcoda.com/custom-segue-animations/转载 2015-01-27 10:48:56 · 802 阅读 · 0 评论 -
Xcode及模拟器SDK下载
如果你嫌在App Store下载Xcode太慢的话,你也可以选择从网络上下载:Xcode下载Xcode 6.2 Beta 2:http://pan.baidu.com/s/1c0pNFC8Xcode 6.2 Beta:http://pan.baidu.com/s/1i3xe1qHXcode 6.1.1 GM SEED:ht转载 2015-01-26 15:18:44 · 982 阅读 · 0 评论 -
如何通过代码添加ChildViewController
在Storyboard中可以通过使用embed segue连接Parent ViewController和Child ViewController。(通过Object Library的Container View可实现)如果想在代码中添加Child ViewController,步骤如下:假设我们要在Parent ViewController的ContainerView里添加Chi原创 2015-01-17 23:56:14 · 2155 阅读 · 0 评论 -
UILabel如何在Interface Builder中换行
在Interface Builder中,选中要换行的UILabel,在属性面板中,选中文本框,输入第一行文字,预要换行时,按住Optional(Alt)+Enter,自动切换到第二行,(如果直接按enter键,则是确定输入的内容,不会自动换行),同时别忘了将Lines属性设置为0。原创 2015-01-21 10:15:24 · 3266 阅读 · 0 评论 -
UIScrollview 键盘遮挡问题
#pragma mark - UIKeyboard Obscure Problem- (void)handleKeyboardStuff { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNo原创 2015-01-22 18:15:14 · 1834 阅读 · 0 评论 -
MagicalRecord如何存储实体
Poo *poo = [Poo MR_findFirst];// Update the entity in the block of saveWithBlock:[MagicalRecord saveWithBlock:^(NSManagedObjectContext *localContext) { Poo *localPoo = [poo inContext:localContex原创 2015-01-23 23:07:34 · 1594 阅读 · 0 评论 -
日期格式如何获取星期几
This should display 'Tue':new SimpleDateFormat("EEE").format(new Date());This should display 'Tuesday':new SimpleDateFormat("EEEE").format(new Date());So your specific example would be:new Sim原创 2015-01-23 21:58:51 · 2963 阅读 · 0 评论 -
AppDelegate生命周期回调顺序
1. 应用初次启动:- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions- (void)applicationDidBecomeActive:(UIApplication *)application2. 连续点击原创 2015-03-09 10:04:22 · 1206 阅读 · 0 评论 -
iOS block内为什么要使用strongSelf
先摘抄一段来自AFNetworking的一段代码:__weak __typeof(self)weakSelf = self;AFNetworkReachabilityStatusBlock callback = ^(AFNetworkReachabilityStatus status) { __strong __typeof(weakSelf)strongSelf = weakSe...原创 2018-08-15 11:32:38 · 3624 阅读 · 0 评论