简体   繁体   中英

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:

Original Post: 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 . 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. confused

Any help would be greatly appreciated.

They are talking about inheritance. more info here 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM