Skip to content

Commit 4d11430

Browse files
committed
Fix UIDIC placement on iPad
1 parent 2d801ff commit 4d11430

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

MiniKeePass/GroupViewController.m

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ - (NSUInteger)updatePositionOfObject:object inArray:array;
4747
@property (nonatomic, copy) NSString *renameButtonTitle;
4848
@property (nonatomic, assign) CGFloat currentButtonWidth;
4949

50+
@property (nonatomic, retain) UIBarButtonItem *settingsButton;
51+
@property (nonatomic, retain) UIBarButtonItem *actionButton;
52+
@property (nonatomic, retain) UIBarButtonItem *addButton;
53+
5054
@end
5155

5256
@implementation GroupViewController
@@ -73,19 +77,19 @@ - (void)viewDidLoad {
7377

7478
[searchBar release];
7579

76-
UIBarButtonItem *settingsButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"gear"] style:UIBarButtonItemStylePlain target:appDelegate action:@selector(showSettingsView)];
77-
settingsButton.imageInsets = UIEdgeInsetsMake(2, 0, -2, 0);
78-
UIBarButtonItem *actionButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(exportFilePressed)];
79-
UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addPressed)];
80+
self.settingsButton = [[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"gear"] style:UIBarButtonItemStylePlain target:appDelegate action:@selector(showSettingsView)] autorelease];
81+
self.settingsButton.imageInsets = UIEdgeInsetsMake(2, 0, -2, 0);
82+
83+
self.actionButton = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(exportFilePressed)] autorelease];
84+
85+
self.addButton = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addPressed)] autorelease];
86+
8087
UIBarButtonItem *spacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
81-
82-
self.standardToolbarItems = @[settingsButton, spacer, actionButton, spacer, addButton];
88+
89+
self.standardToolbarItems = @[self.settingsButton, spacer, self.actionButton, spacer, self.addButton];
8390
self.toolbarItems = self.standardToolbarItems;
8491
self.navigationItem.rightBarButtonItem = self.editButtonItem;
8592

86-
[settingsButton release];
87-
[actionButton release];
88-
[addButton release];
8993
[spacer release];
9094

9195
results = [[NSMutableArray alloc] init];
@@ -185,9 +189,17 @@ - (void)dealloc {
185189
[_moveButtonTitle release];
186190
[_renameButton release];
187191
[_renameButtonTitle release];
192+
[_settingsButton release];
193+
[_actionButton release];
194+
[_addButton release];
188195
[super dealloc];
189196
}
190197

198+
- (void)viewDidDisappear:(BOOL)animated {
199+
[appDelegate.databaseDocument.documentInteractionController dismissMenuAnimated:NO];
200+
[super viewDidDisappear:animated];
201+
}
202+
191203
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
192204
if (UIInterfaceOrientationIsPortrait(toInterfaceOrientation)) {
193205
self.currentButtonWidth = PORTRAIT_BUTTON_WIDTH;
@@ -755,7 +767,7 @@ - (void)formViewController:(FormViewController *)controller button:(FormViewCont
755767
}
756768

757769
- (void)exportFilePressed {
758-
BOOL didShow = [appDelegate.databaseDocument.documentInteractionController presentOpenInMenuFromRect:CGRectZero inView:self.view.window.rootViewController.view animated:YES];
770+
BOOL didShow = [appDelegate.databaseDocument.documentInteractionController presentOpenInMenuFromBarButtonItem:self.actionButton animated:YES];
759771
if (!didShow) {
760772
NSString *prompt = NSLocalizedString(@"There are no applications installed capable of importing KeePass files", nil);
761773
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:prompt delegate:nil cancelButtonTitle:NSLocalizedString(@"OK", nil) destructiveButtonTitle:nil otherButtonTitles:nil];

0 commit comments

Comments
 (0)