3
3
#import " ../IconManager/IconManager.h"
4
4
#import " ../ObjCBridge/ObjCBridge.h"
5
5
#import " ../Navigation/UINavigator.h"
6
+ #import " ../Util/UIBarImageButtonItem.h"
6
7
#import " GlobalPreferences.h"
7
8
#import " FontSelectorViewController.h"
8
9
#import " FontSizePreviewViewController.h"
9
10
#import " AppManagerViewController.h"
10
11
12
+ @interface PreferencesViewController ()
13
+ - (void )onSDKInfoButtonSelected ;
14
+ @end
15
+
11
16
@implementation PreferencesViewController
12
17
13
18
@synthesize preferences;
@@ -20,6 +25,8 @@ - (id)init
20
25
return nil ;
21
26
}
22
27
28
+ fileExplorer = nil ;
29
+
23
30
UIBarButtonItem*doneButton = [[UIBarButtonItem alloc ] initWithBarButtonSystemItem: UIBarButtonSystemItemDone target: self action: @selector (doneButtonSelected )];
24
31
[self .navigationItem setTitle: @" Preferences" ];
25
32
[self .navigationItem setRightBarButtonItem: doneButton];
@@ -43,11 +50,6 @@ - (void)viewWillAppear:(BOOL)animated
43
50
- (void )viewDidAppear : (BOOL )animated
44
51
{
45
52
[super viewDidAppear: animated];
46
- if (fileExplorer!=nil )
47
- {
48
- [fileExplorer release ];
49
- fileExplorer = nil ;
50
- }
51
53
}
52
54
53
55
- (void )doneButtonSelected
@@ -173,11 +175,19 @@ - (void)tableView:(UITableView*)tableView didSelectRowAtIndexPath:(NSIndexPath*)
173
175
{
174
176
NSString * sdkPath = [[NSString alloc ] initWithUTF8String: Global_getSDKFolderPath ()];
175
177
fileExplorer = [[UIFileBrowserViewController alloc ] initWithString: @" " root: sdkPath delegate: self ];
176
- UIBarButtonItem* cancelButton = [[UIBarButtonItem alloc ] initWithBarButtonSystemItem: UIBarButtonSystemItemCancel target: self action: @selector (cancelFileExplorer )];
177
- [fileExplorer.navigationBar setBarStyle: UIBarStyleBlack];
178
- [fileExplorer.navigationBar.topItem setLeftBarButtonItem: cancelButton];
179
- [cancelButton release ];
180
- [self presentModalViewController: fileExplorer animated: YES ];
178
+ if (fileExplorer!=nil )
179
+ {
180
+ [fileExplorer setDelegate: self ];
181
+ [fileExplorer.navigationBar setBarStyle: UIBarStyleBlack];
182
+ UIBarButtonItem* cancelButton = [[UIBarButtonItem alloc ] initWithBarButtonSystemItem: UIBarButtonSystemItemCancel target: self action: @selector (cancelFileExplorer )];
183
+ [fileExplorer.navigationBar.topItem setLeftBarButtonItem: cancelButton];
184
+ [cancelButton release ];
185
+ UIBarButtonItem* infoButton = [[UIBarImageButtonItem alloc ] initWithType: UIButtonTypeInfoLight target: self action: @selector (onSDKInfoButtonSelected )];
186
+ [fileExplorer.navigationBar.topItem setRightBarButtonItem: infoButton];
187
+ [infoButton release ];
188
+ [self presentModalViewController: fileExplorer animated: YES ];
189
+ [fileExplorer release ];
190
+ }
181
191
[sdkPath release ];
182
192
}
183
193
break ;
@@ -257,13 +267,16 @@ - (void)fileBrowser:(UIFileBrowserViewController*)fileBrowser didSelectFolder:(N
257
267
[fileExplorer dismissModalViewControllerAnimated: YES ];
258
268
}
259
269
270
+ - (void )onSDKInfoButtonSelected
271
+ {
272
+ const char * message = " SDKs can be added by copying a .sdk package from xcode to /var/stash/Developer/SDKs on your device.\n\n "
273
+ " If you have issues, you may need to zip the package before you copy it, and then unzip it on the device. "
274
+ " Sometimes symbolic links can get messed up." ;
275
+ showSimpleMessageBox (NULL , message);
276
+ }
277
+
260
278
- (void )dealloc
261
279
{
262
- if (fileExplorer!=nil )
263
- {
264
- [fileExplorer release ];
265
- fileExplorer = nil ;
266
- }
267
280
[preferences release ];
268
281
[super dealloc ];
269
282
}
0 commit comments