Skip to content

Instantly share code, notes, and snippets.

@marshluca
Created October 14, 2010 09:44
Show Gist options
  • Save marshluca/625953 to your computer and use it in GitHub Desktop.
Save marshluca/625953 to your computer and use it in GitHub Desktop.
#import <Foundation/Foundation.h>
@interface MyButton : UIButton
{
NSDictionary *dict;
}
@property (nonatomic, retain) NSDictionary *dict;
- (id)initWithDict:(NSDictionary *)aDict;
@end
#import "MyButton.h"
@implementation MyButton
@synthesize dict;
- (id)initWithDict:(NSDictionary *)aDict {
if (self = [super init]) {
dict = aDict;
}
return self;
}
- (void)dealloc
{
[dict release];
[super dealloc];
}
@end
- (void)showDetails:(id)sender
{
[self.navigationController setToolbarHidden:YES animated:NO];
PlaceOneViewController *poController = [[PlaceOneViewController alloc] initWithDict:[sender dict]];
[self.navigationController pushViewController:poController animated:YES];
}
- (void)loadButton
{
MyButton *rightButton = [[MyButton alloc] initWithDict:annotation.dict];
[rightButton setImage:[UIImage imageNamed:@"flag.png"] forState:UIControlStateNormal];
rightButton.frame = CGRectMake(0, 0, 25, 25);
[rightButton addTarget:self action:@selector(showDetails:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:rightButton];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment