03 2014 档案

摘要:Q:In my iPhone application built with Xcode 5 for iOS 7 I set UIViewControllerBasedStatusBarAppearance=YES in info.plist, and in my ViewController I have this code:-(UIStatusBarStyle) preferredStatusBarStyle{ returnUIStatusBarStyleLightContent;}But the status bar is still black against the black ... 阅读全文
posted @ 2014-03-31 15:53 有妄想症的猫zz 阅读(3983) 评论(0) 推荐(0) 编辑
摘要:如 iPhone 内应用“信息”的输入框一样,输入文字过多或者输入换行,输入框可以随着内容自动变化。主要是计算内容的尺寸并相应更改输入框的frame。具体表现在:更改输入框的 frame.origin.y;更改输入框的高度。两者的变化量是相同的。为了能达到实时性,就要监听文字的变化,注册 UITextViewTextDidChangeNotification 的监听,并在合适的时候解除监听。- (void)willMoveToSuperview:(UIView *)newSuperview{ [[NSNotificationCenter defaultCenter] addObserve... 阅读全文
posted @ 2014-03-27 23:55 有妄想症的猫zz 阅读(4759) 评论(1) 推荐(2) 编辑
摘要:如果一个页面拥有一个NSFetchedResultsController 的引用,那么在这个界面将要结束时,一定要 remove 它的 observer- (void)dealloc { //... [[NSNotificationCenter defaultCenter] removeObserver:self.fetchedResultsController]; _fetchedResultsController.delegate = nil; [_fetchedResultsController release]; [super dealloc];}为什么呢... 阅读全文
posted @ 2014-03-26 17:45 有妄想症的猫zz 阅读(2160) 评论(0) 推荐(0) 编辑
摘要:先看一下 NSArray 是怎么传递 block 参数的...@interface NSArray (NSExtendedArray)…#if NS_BLOCKS_AVAILABLE- (void)enumerateObjectsUsingBlock:(void (^)(id obj, NSUInteger idx, BOOL *stop))block NS_AVAILABLE(10_6, 4_0);…@end对于不需要参数的情况,比如只是想在某个方法结束后调用另一方法//实现- (void)endInput:(void (^)())completion{ [UIView animate... 阅读全文
posted @ 2014-03-24 16:19 有妄想症的猫zz 阅读(14664) 评论(0) 推荐(0) 编辑
摘要:先来看一下 UIBarItem 的 title 的描述The title displayed on the item.You should set this property before adding the item to a bar. The default value is nil.它的默认值为nil,你应该在把 item 添加到 bar 上前设置好它。我们都知道,当我们 push 一个 viewController 后,返回 item 上的 title 正是上一个 viewController 的title;而且当 viewController 的 title 改变时,item 的 阅读全文
posted @ 2014-03-10 17:24 有妄想症的猫zz 阅读(9323) 评论(0) 推荐(0) 编辑
摘要:先是 html 文件内容// index.html John : This is out Rich Text Editing View 加载 html 文件- (void)viewDidLoad{ [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. NSBundle *mainBundle = [NSBundle mainBundle]; NSUR... 阅读全文
posted @ 2014-03-04 16:21 有妄想症的猫zz 阅读(23825) 评论(1) 推荐(0) 编辑
摘要:如 AlertView,当 show 一个 Alert 时,它会覆盖在 Keyboard 上面,不影响显示的效果。那么我们自己创建的 View 如何像 Alert 那样不被键盘盖住呢?很简单,拿到 Application 的 最上面一个 window,把 View 加到这个 window 上,就可以了。UIWindow *window = [[[UIApplication sharedApplication] windows] lastObject];[window addSubview:view];Stack Overflow 阅读全文
posted @ 2014-03-03 13:33 有妄想症的猫zz 阅读(3661) 评论(0) 推荐(0) 编辑
摘要:http://wonderffee.github.io/blog/2013/10/13/understand-anchorpoint-and-position/ 阅读全文
posted @ 2014-03-01 21:58 有妄想症的猫zz 阅读(281) 评论(0) 推荐(0) 编辑