(iOS Menu) Cleanups

This commit is contained in:
Twinaphex 2015-01-15 00:57:37 +01:00
parent 1b06490527
commit db81a99b54
1 changed files with 12 additions and 7 deletions

View File

@ -98,7 +98,9 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
- (NSString*)tableView:(UITableView*)tableView titleForHeaderInSection:(NSInteger)section - (NSString*)tableView:(UITableView*)tableView titleForHeaderInSection:(NSInteger)section
{ {
return self.hidesHeaders ? nil : self.sections[section][0]; if (self.hidesHeaders)
return nil;
return self.sections[section][0];
} }
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
@ -255,11 +257,12 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
- (UITableViewCell*)cellForTableView:(UITableView*)tableView - (UITableViewCell*)cellForTableView:(UITableView*)tableView
{ {
char buffer[PATH_MAX]; char buffer[PATH_MAX];
UITableViewCell* result;
static NSString* const cell_id = @"string_setting"; static NSString* const cell_id = @"string_setting";
self.parentTable = tableView; self.parentTable = tableView;
UITableViewCell* result = [tableView dequeueReusableCellWithIdentifier:cell_id]; result = [tableView dequeueReusableCellWithIdentifier:cell_id];
if (!result) if (!result)
{ {
result = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cell_id]; result = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cell_id];
@ -317,12 +320,14 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
{ {
NSString* text = (NSString*)[alertView textFieldAtIndex:0].text; NSString* text = (NSString*)[alertView textFieldAtIndex:0].text;
if (buttonIndex == alertView.firstOtherButtonIndex && text.length) if (buttonIndex != alertView.firstOtherButtonIndex)
{ return;
if (!text.length)
return;
setting_data_set_with_string_representation(self.setting, [text UTF8String]); setting_data_set_with_string_representation(self.setting, [text UTF8String]);
[self.parentTable reloadData]; [self.parentTable reloadData];
} }
}
- (void)attachDefaultingGestureTo:(UIView*)view - (void)attachDefaultingGestureTo:(UIView*)view
{ {