Xcode4 重写Obj-c中的方法不起作用
我仍然在学习Obj-c。 我试图从Three20重写TTThumbsTableViewCell中的setColumnCount方法, 但我不知道为什么它不起作用。 在超类(TTThumbsTableViewCell)的方法setColumnCount中,我添加了一个NSLog(@“Test super”)和setColumnCount方法中TTThumbsTableViewCell的子类,我添加了NSLog(@“Test Sub”),子类方法从不打印“Test Sub” 我不确定是否在Obj-C中正确重写,基本上我将整个方法setColumnCount从TTThumbsTableViewCell复制到子类并在那里修改它,但它仍然没有在子类中运行被重写的方法 有什么我遗漏的吗? 我正在使用XCode 4 提前谢谢 布雷特Xcode4 重写Obj-c中的方法不起作用,xcode4,overriding,Xcode4,Overriding,我仍然在学习Obj-c。 我试图从Three20重写TTThumbsTableViewCell中的setColumnCount方法, 但我不知道为什么它不起作用。 在超类(TTThumbsTableViewCell)的方法setColumnCount中,我添加了一个NSLog(@“Test super”)和setColumnCount方法中TTThumbsTableViewCell的子类,我添加了NSLog(@“Test Sub”),子类方法从不打印“Test Sub” 我不确定是否在Obj-C
南非我有一个名为GridImage的TTThumbsTableViewCell子类
@interface GridImage:TTThumbsTableViewCell’protocol from Three20?在没有看到代码的情况下无法说出任何事情……嗨,Jon Reid,谢谢你的回复,很抱歉没有代码的帖子。我马上答复。
//Code...
_columnCount = columnCount;
for (NSInteger i = _thumbViews.count; i < _columnCount; ++i) {
TTThumbView* thumbView = [[[TTThumbView alloc] init] autorelease];
[thumbView addTarget:self action:@selector(thumbTouched:)
forControlEvents:UIControlEventTouchUpInside];
[self.contentView addSubview:thumbView];
[_thumbViews addObject:thumbView];
if (_photo) {
[self assignPhotoAtIndex:_photo.index+i toView:thumbView];
}
}