mirror of
https://github.com/zhigang1992/RETableViewManager.git
synced 2026-06-12 00:35:23 +08:00
Refactoring
This commit is contained in:
@@ -41,9 +41,7 @@
|
||||
self.barStyle = UIBarStyleBlackTranslucent;
|
||||
}
|
||||
|
||||
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Done", @"")
|
||||
style:UIBarButtonItemStyleDone target:self
|
||||
action:@selector(handleActionBarDone:)];
|
||||
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Done", @"") style:UIBarButtonItemStyleDone target:self action:@selector(handleActionBarDone:)];
|
||||
|
||||
_navigationControl = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:NSLocalizedString(@"Previous", @""), NSLocalizedString(@"Next", @""), nil]];
|
||||
_navigationControl.momentary = YES;
|
||||
@@ -60,16 +58,14 @@
|
||||
|
||||
- (void)handleActionBarPreviousNext:(UISegmentedControl *)segmentedControl
|
||||
{
|
||||
if ([_actionBarDelegate respondsToSelector:@selector(actionBar:navigationControlValueChanged:)]) {
|
||||
if ([_actionBarDelegate respondsToSelector:@selector(actionBar:navigationControlValueChanged:)])
|
||||
[_actionBarDelegate actionBar:self navigationControlValueChanged:segmentedControl];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)handleActionBarDone:(UIBarButtonItem *)doneButtonItem
|
||||
{
|
||||
if ([_actionBarDelegate respondsToSelector:@selector(actionBar:doneButtonPressed:)]) {
|
||||
if ([_actionBarDelegate respondsToSelector:@selector(actionBar:doneButtonPressed:)])
|
||||
[_actionBarDelegate actionBar:self doneButtonPressed:doneButtonItem];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -136,27 +136,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (float)groupedCellMarginWithTableWidth:(float)tableViewWidth
|
||||
{
|
||||
float marginWidth;
|
||||
if(tableViewWidth > 20)
|
||||
{
|
||||
if(tableViewWidth < 400)
|
||||
{
|
||||
marginWidth = 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
marginWidth = MAX(31, MIN(45, tableViewWidth*0.06));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
marginWidth = tableViewWidth - 10;
|
||||
}
|
||||
return marginWidth;
|
||||
}
|
||||
|
||||
- (RETableViewCellType)cellType
|
||||
{
|
||||
if (self.row == 0 && self.section.items.count == 1)
|
||||
|
||||
@@ -80,16 +80,17 @@
|
||||
for (NSDictionary *dictionary in items) {
|
||||
NSString *username = [dictionary objectForKey:@"username"];
|
||||
NSString *userpic = [dictionary objectForKey:@"userpic"];
|
||||
NSString *image = [dictionary objectForKey:@"image"];
|
||||
NSString *imageName = [dictionary objectForKey:@"image"];
|
||||
|
||||
// Create section with a header view
|
||||
//
|
||||
RETableViewSection *section = [[RETableViewSection alloc] initWithHeaderView:[ListHeaderView headerViewWithImageNamed:userpic username:username]];
|
||||
ListHeaderView *headerView = [ListHeaderView headerViewWithImageNamed:userpic username:username];
|
||||
RETableViewSection *section = [RETableViewSection sectionWithHeaderView:headerView];
|
||||
[_manager addSection:section];
|
||||
|
||||
// Add item (image)
|
||||
//
|
||||
[section addItem:[ListImageItem itemWithImageNamed:image]];
|
||||
[section addItem:[ListImageItem itemWithImageNamed:imageName]];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user