/
KSPopoverViewViewController.m
executable file
·68 lines (56 loc) · 1.8 KB
/
KSPopoverViewViewController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//
// KSPopoverViewViewController.m
// KSPopoverView
//
// Copyright 2010 Katokichi Software. All rights reserved.
//
#import "KSPopoverViewViewController.h"
@implementation KSPopoverViewViewController
- (void)viewDidLoad {
[super viewDidLoad];
UIImage *image = [UIImage imageNamed:@"katokichi"];
_menu = [[KSPopoverView alloc] initWithType:KSPopoverTypeOnOffLabel
image:image
point:CGPointMake(50.0f, 340.0f)];
_menu.delegate = self;
_menu.position = KSPopoverPositionTopCenter;
_menu.offset = 50;
//_menu.debug = YES;
[self.view addSubview:_menu];
[_menu addButtonWithTitle:@"11111111"];
[_menu addButtonWithTitle:@"2222222222"];
[_menu addButtonWithTitle:@"3333333"];
[_menu addButtonWithTitle:@"444444444"];
[_menu addButtonWithTitle:@"555"];
[_menu addButtonWithTitle:@"666666666666"];
}
/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
[_menu release];
_menu = nil;
}
- (void)dealloc {
[_menu release];
[super dealloc];
}
#pragma mark -
- (void)popoverView:(KSPopoverView *)view selectedButtonIndex:(NSInteger)buttonIndex
withInfo:(NSDictionary *)info {
NSLog(@"Pushed %dth button. info:%@", buttonIndex, info);
KSPopoverViewButtonBase *button = [view labelAtIndex:buttonIndex];
button.text = @"pressed";
}
@end