我正在开展一个项目,我必须预先选择一个特定的单元格.
我可以预先选择一个单元格-willDisplayCell,但是当用户点击任何其他单元格时我无法取消选择它.
- (void)tableView:(UITableView*)tableView
willDisplayCell:(UITableViewCell*)cell
forRowAtIndexPath:(NSIndexPath*)indexPath
{
AppDelegate_iPad *appDelegte =
(AppDelegate_iPad *)[[UIApplication sharedApplication] delegate];
if ([appDelegte.indexPathDelegate row] == [indexPath row])
{
[cell setSelected:YES];
}
}
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
AppDelegate_iPad *appDelegte =
(AppDelegate_iPad *)[[UIApplication sharedApplication] delegate];
NSIndexPath *indexpath1 = appDelegte.indexPathDelegate;
appDelegte.indexPathDelegate = indexPath;
[materialTable deselectRowAtIndexPath:indexpath1 animated:NO];
}
Run Code Online (Sandbox Code Playgroud)
你能帮我吗?
在我的程序中,我试图在字典中设置对象.值来自另一个类,因此我在处理它之前复制了这些值.
在分析代码时,我得到了泄漏.
-(void)giveInput:(NSString *)userInput ForPlaceholder:(NSString *)placeholder{
[inputValue setObject:[userInput copy] forKey:[placeholder copy]];
}
Run Code Online (Sandbox Code Playgroud)
如何释放userINput和Placehoder对象保留计数?
嗨,我是iphone的新手,开始学习Obj c.
我已经注意到函数定义,对于我们正在使用的某些函数( - )以及我们正在使用的某些函数(+)
示例:+(id)requestWithURL:(NSURL*)theURL
- initWithURL:
这两个运算符/符号的用法有什么区别?
谢谢!