随笔分类 - iOS
iOS development
摘要:ViewController加载完成以后,旋转屏幕,会触发以下事件: 注:ShowViewCycle是ViewController的SubView1. -[ViewController willTransitionToTraitCollection:withTransitionCoordinato...
阅读全文
摘要:ViewController加载过程(ShowViewCycle是ViewController.view的subView):1. -[ViewController initWithNibName:bundle:] [Line 82] nibNameOrNil:(null), nibBundleOrN...
阅读全文
摘要:查看crash日志的步骤:1.找到xcode自带的文symbolicatecrash,路径是/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFramewor...
阅读全文
摘要:原文地址:http://jianyu996.blog.163.com/blog/static/112114555201305113018814/首先两个方法都是异步执行。layoutSubviews方便数据计算,drawRect方便视图重绘。layoutSubviews在以下情况下会被调用:1、init初始化不会触发layoutSubviews。2、addSubview会触发layoutSubviews。3、设置view的Frame会触发layoutSubviews,当然前提是frame的值设置前后发生了变化。4、滚动一个UIScrollView会触发layoutSubviews。5、旋转Sc
阅读全文
摘要:代码修改如下:- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ _window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; _rootViewController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:[NS
阅读全文
摘要:I think the reason why it's now absent is that creating a window programmatically is much more efficient than opening a xib file and unarchiving the objects. Generally, if you can do it in one line of code, you should do that in code.It is has always been an option not to use MainWindow.xib. The
阅读全文
摘要:如果要限制UITextField输入长度最长不超过kMaxLength,那么需要实现做以下操作:1、实现UITextFieldDelegate协议;2、实现textField:shouldChangeCharactersInRange:replacementString:方法;- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{ NSInteger strLength = textField.tex
阅读全文
摘要:如何使得XCode的Build版本号自增的问题一直困扰着我,今天通过GOOGLE终于找到,分享给大家。注:本人使用的XCode版本号为4.3.21、进入“Tagerts”,打开“Build Phases”;2、选择“Add Build Phases”,选择“Add Run Script”;3、在Shell中输入:#!/bin/bash buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE")buildNumber=$(($buildNumber
阅读全文
摘要:Before entering into a discussion about concurrency, it is necessary to define some relevant terminology to prevent confusion. Developers who are more familiar with UNIX systems or older Mac OS X technologies may find the terms “task”, “process”, and “thread” used somewhat differently in this docume
阅读全文
摘要:我在学习《Beginning iPhone 4 Development Exploring the iOS SDK》(中文版的名称为《iPhone 4与iPad开发基础教程》)这本书 有一个关于第6章View Switcher这个例子中 - (IBAction)switchViews:(id)sender 这个函数中处理动画flip效果的一个问题 请看代码 - (IBAction)switchViews:(id)sender { [UIView beginAnimations:@"View Flip" context:nil]; [UIView setAnimationDu
阅读全文
摘要:现有的Cocoa框架中,自动缓冲池可以使用如下的格式:@autoreleasepool { // Code benefitting from a local autorelease pool.}优点: 1、不用管是否使用Automatic Reference Counting (ARC); 2、不用受到drain和release的困扰; 3、不用担心忘记了release或drain; 4、效率更高;总之,方便、实用、高效,赶快使用吧。
阅读全文

浙公网安备 33010602011771号