[英]iPhone/Objective-C - Subclassing TTLauncherView methods to get pageChanged
I would like to determine when a page changes in a TTLauncherView
and some people have said I should subclass the method: 我想确定
TTLauncherView
的页面何时发生变化,有人说我应该对该方法进行子类化:
Original Post: http://groups.google.com/group/three20/browse_thread/thread/caf702363f3abaa8/862f69e52dcc3981 原始帖子: http : //groups.google.com/group/three20/browse_thread/thread/caf702363f3abaa8/862f69e52dcc3981
- (void)updatePagerWithContentOffset:(CGPoint)contentOffset;
I'm not quite sure what they mean about subclassing? 我不太确定它们对子类化的含义是什么?
I tried doing the following: 我尝试执行以下操作:
@interface TTLauncherView (MyExtensions)
- (void)updatePagerWithContentOffset:(CGPoint)contentOffset;
@end
@implementation TTLauncherView (MyExtensions)
- (void)updatePagerWithContentOffset:(CGPoint)contentOffset {
NSLog(@"Foo");
}
@end
I'm not quite sure what this is meant to achieve though? 我不太确定这意味着什么? I need to update a value depending on the
_launcherView.pager.currentPage
. 我需要根据
_launcherView.pager.currentPage
更新一个值。 There is currently no delegate method that allows the checking of what page you're currently on or when a page has changed (or maybe I don't know where to look). 当前没有委托方法可以检查您当前在哪个页面上或页面何时更改(或者也许我不知道在哪里查找)。 Also
_launcherView.pager.currentPage
is always 0 any way. _launcherView.pager.currentPage
也始终为0。 confused 困惑
Any help would be greatly appreciated. 任何帮助将不胜感激。
They are talking about inheritance. 他们在谈论继承。 more info here http://www.otierney.net/objective-c.html#inheritance
此处的更多信息http://www.otierney.net/objective-c.html#inheritance
try this 尝试这个
@interface MyLauncher:TTLauncherView (MyExtensions)
{}
- (void)updatePagerWithContentOffset:(CGPoint)contentOffset;
@end
@implementation MyLauncher (MyExtensions)
- (void)updatePagerWithContentOffset:(CGPoint)contentOffset {
NSLog(@"Foo");
}
@end
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.