- (void) start:(id)sender
{
UIButton * charButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[self.view addSubview:charButton];
[charButton release];//这里会导致crash。不应该release
}
The rule for this is that you program in the UIView class and not in the UIViewController class
All members and children of the UIResponder class, including UIView, respond to touches.
performSelector:withObject:afterDelay:
Invokes a method of the receiver on the current thread using the default mode after a delay.
notificationcenter的通知会跨线程吗?
与线程无关
+++++++++++++++++
TableView 性能问题讨论
However, if the content of a cell is composed of more than three or four subviews, scrolling performance might suffer. In this case (and especially if the cell is not editable), consider drawing directly in one subview of the cell’s content view. The gist of this guideline is that, when implementing custom table-view cells, be aware that there is a tradeoff between optimal scrolling performance and optimal editing or reordering performance.使用 drawInRect 来提高性能
滚动卡的主要原因在于 a cell 的 subview 太多了
UILongPressGestureRecognizer * longPressGR = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)];
longPressGR.minimumPressDuration = 0.1; // 这里设太长比如为1会导致无法捕捉长按事件
[self.contentView addGestureRecognizer:longPressGR];
[longPressGR release];
++++++++++++++
在xib里font size勾选了adjust to fit后,导致程序里无法设font的大小。不选则可以。
+++++++++++++++
uiwebview无法检测到touchBegan等事件。 明显是程序有bug
+++++++++++++++++++
xcoder 配svn
选中项目名。
SCM->Configure SCM For This Project...->右上角点击Configure Roots & SCM...->选中你刚才创建的Repository
+++++++++++++++++++++
按钮RoundRectButton无法隐藏边框,type改为custom即可
++++++++++
NSString *wording = [NSString stringWithFormat:@"wording('%@')", NSLocalizedString(@"Load More", nil)];
[self.webView stringByEvaluatingJavaScriptFromString:wording];
这里执行js不返回null但页面元素没有变化,是因为页面的元素还没load好。推迟到load好后再执行即可
++++++++++++++
UIScrollView的setContentOffset会导致滚动,– scrollViewDidScroll:被触发