mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 14:45:21 +00:00
More UI updates for iOS 7 style feedback
This commit is contained in:
@@ -75,8 +75,8 @@
|
|||||||
NSInteger _userButtonSection;
|
NSInteger _userButtonSection;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)init {
|
- (instancetype)initWithStyle:(UITableViewStyle)style {
|
||||||
if ((self = [super init])) {
|
if ((self = [super initWithStyle:style])) {
|
||||||
_manager = [BITHockeyManager sharedHockeyManager].feedbackManager;
|
_manager = [BITHockeyManager sharedHockeyManager].feedbackManager;
|
||||||
|
|
||||||
_deleteButtonSection = -1;
|
_deleteButtonSection = -1;
|
||||||
@@ -125,13 +125,13 @@
|
|||||||
[self.tableView setBackgroundColor:[UIColor colorWithRed:0.82 green:0.84 blue:0.84 alpha:1]];
|
[self.tableView setBackgroundColor:[UIColor colorWithRed:0.82 green:0.84 blue:0.84 alpha:1]];
|
||||||
[self.tableView setSeparatorColor:[UIColor colorWithRed:0.79 green:0.79 blue:0.79 alpha:1]];
|
[self.tableView setSeparatorColor:[UIColor colorWithRed:0.79 green:0.79 blue:0.79 alpha:1]];
|
||||||
} else {
|
} else {
|
||||||
[self.tableView setBackgroundColor:[UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:1]];
|
// [self.tableView setBackgroundColor:[UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:1]];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([self.manager isPreiOS7Environment]) {
|
if ([self.manager isPreiOS7Environment]) {
|
||||||
self.view.backgroundColor = DEFAULT_BACKGROUNDCOLOR;
|
self.view.backgroundColor = DEFAULT_BACKGROUNDCOLOR;
|
||||||
} else {
|
} else {
|
||||||
self.view.backgroundColor = DEFAULT_BACKGROUNDCOLOR_OS7;
|
// self.view.backgroundColor = DEFAULT_BACKGROUNDCOLOR_OS7;
|
||||||
}
|
}
|
||||||
|
|
||||||
id refreshClass = NSClassFromString(@"UIRefreshControl");
|
id refreshClass = NSClassFromString(@"UIRefreshControl");
|
||||||
@@ -381,21 +381,21 @@
|
|||||||
#pragma mark - Table view data source
|
#pragma mark - Table view data source
|
||||||
|
|
||||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
||||||
NSInteger rows = 2;
|
NSInteger sections = 2;
|
||||||
_deleteButtonSection = -1;
|
_deleteButtonSection = -1;
|
||||||
_userButtonSection = -1;
|
_userButtonSection = -1;
|
||||||
|
|
||||||
if ([self.manager isManualUserDataAvailable] || [self.manager didAskUserData]) {
|
if ([self.manager isManualUserDataAvailable] || [self.manager didAskUserData]) {
|
||||||
_userButtonSection = rows;
|
_userButtonSection = sections;
|
||||||
rows++;
|
sections++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([self.manager numberOfMessages] > 0) {
|
if ([self.manager numberOfMessages] > 0) {
|
||||||
_deleteButtonSection = rows;
|
_deleteButtonSection = sections;
|
||||||
rows++;
|
sections++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return rows;
|
return sections;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||||
@@ -406,6 +406,32 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
|
||||||
|
if (![self.manager isPreiOS7Environment]) {
|
||||||
|
if (section == 0) {
|
||||||
|
return 30;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return [super tableView:tableView heightForHeaderInSection:section];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
|
||||||
|
if (![self.manager isPreiOS7Environment] && section == 0) {
|
||||||
|
UIView *containerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 30.0f)];
|
||||||
|
UILabel *textLabel = [[UILabel alloc] initWithFrame:CGRectMake(16.0f, 5.0f, self.view.frame.size.width - 32.0f, 25.0f)];
|
||||||
|
textLabel.text = [NSString stringWithFormat:BITHockeyLocalizedString(@"HockeyFeedbackListLastUpdated"),
|
||||||
|
[self.manager lastCheck] ? [self.lastUpdateDateFormatter stringFromDate:[self.manager lastCheck]] : BITHockeyLocalizedString(@"HockeyFeedbackListNeverUpdated")];
|
||||||
|
textLabel.font = [UIFont systemFontOfSize:10];
|
||||||
|
textLabel.textColor = DEFAULT_TEXTCOLOR;
|
||||||
|
[containerView addSubview:textLabel];
|
||||||
|
|
||||||
|
return containerView;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [super tableView:tableView viewForHeaderInSection:section];
|
||||||
|
}
|
||||||
|
|
||||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||||
static NSString *CellIdentifier = @"MessageCell";
|
static NSString *CellIdentifier = @"MessageCell";
|
||||||
static NSString *LastUpdateIdentifier = @"LastUpdateCell";
|
static NSString *LastUpdateIdentifier = @"LastUpdateCell";
|
||||||
@@ -413,7 +439,7 @@
|
|||||||
static NSString *ButtonBottomIdentifier = @"ButtonBottomCell";
|
static NSString *ButtonBottomIdentifier = @"ButtonBottomCell";
|
||||||
static NSString *ButtonDeleteIdentifier = @"ButtonDeleteCell";
|
static NSString *ButtonDeleteIdentifier = @"ButtonDeleteCell";
|
||||||
|
|
||||||
if (indexPath.section == 0 && indexPath.row == 1) {
|
if (indexPath.section == 0 && indexPath.row == 1 && ![self.manager isPreiOS7Environment]) {
|
||||||
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:LastUpdateIdentifier];
|
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:LastUpdateIdentifier];
|
||||||
|
|
||||||
if (!cell) {
|
if (!cell) {
|
||||||
@@ -452,10 +478,19 @@
|
|||||||
cell.textLabel.font = [UIFont systemFontOfSize:14];
|
cell.textLabel.font = [UIFont systemFontOfSize:14];
|
||||||
cell.textLabel.numberOfLines = 0;
|
cell.textLabel.numberOfLines = 0;
|
||||||
cell.accessoryType = UITableViewCellAccessoryNone;
|
cell.accessoryType = UITableViewCellAccessoryNone;
|
||||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
|
||||||
|
if ([self.manager isPreiOS7Environment]) {
|
||||||
|
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||||
|
} else {
|
||||||
|
cell.selectionStyle = UITableViewCellSelectionStyleGray;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// button
|
// button
|
||||||
|
NSString *titleString = nil;
|
||||||
|
SEL actionSelector = nil;
|
||||||
|
UIColor *titleColor = BIT_RGBCOLOR(35, 111, 251);
|
||||||
|
|
||||||
UIButton *button = nil;
|
UIButton *button = nil;
|
||||||
if ([self.manager isPreiOS7Environment]) {
|
if ([self.manager isPreiOS7Environment]) {
|
||||||
button = [UIButton buttonWithType:UIButtonTypeCustom];
|
button = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||||
@@ -470,38 +505,32 @@
|
|||||||
|
|
||||||
[button setTitleColor:BUTTON_TEXTCOLOR forState:UIControlStateNormal];
|
[button setTitleColor:BUTTON_TEXTCOLOR forState:UIControlStateNormal];
|
||||||
[button setTitleShadowColor:BUTTON_TEXTCOLOR_SHADOW forState:UIControlStateNormal];
|
[button setTitleShadowColor:BUTTON_TEXTCOLOR_SHADOW forState:UIControlStateNormal];
|
||||||
} else {
|
|
||||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_6_1
|
|
||||||
button = [UIButton buttonWithType:UIButtonTypeSystem];
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (indexPath.section == 0) {
|
if (indexPath.section == 0) {
|
||||||
topGap = 22;
|
topGap = 22;
|
||||||
if ([self.manager numberOfMessages] == 0) {
|
if ([self.manager numberOfMessages] == 0) {
|
||||||
[button setTitle:BITHockeyLocalizedString(@"HockeyFeedbackListButonWriteFeedback") forState:UIControlStateNormal];
|
titleString = BITHockeyLocalizedString(@"HockeyFeedbackListButonWriteFeedback");
|
||||||
} else {
|
} else {
|
||||||
[button setTitle:BITHockeyLocalizedString(@"HockeyFeedbackListButonWriteResponse") forState:UIControlStateNormal];
|
titleString = BITHockeyLocalizedString(@"HockeyFeedbackListButonWriteResponse");
|
||||||
}
|
}
|
||||||
[button addTarget:self action:@selector(newFeedbackAction:) forControlEvents:UIControlEventTouchUpInside];
|
actionSelector = @selector(newFeedbackAction:);
|
||||||
} else if (indexPath.section == _userButtonSection) {
|
} else if (indexPath.section == _userButtonSection) {
|
||||||
topGap = 6.0f;
|
topGap = 6.0f;
|
||||||
NSString *title = @"";
|
|
||||||
if ([self.manager requireUserName] == BITFeedbackUserDataElementRequired ||
|
if ([self.manager requireUserName] == BITFeedbackUserDataElementRequired ||
|
||||||
([self.manager requireUserName] == BITFeedbackUserDataElementOptional && [self.manager userName] != nil)
|
([self.manager requireUserName] == BITFeedbackUserDataElementOptional && [self.manager userName] != nil)
|
||||||
) {
|
) {
|
||||||
title = [NSString stringWithFormat:BITHockeyLocalizedString(@"HockeyFeedbackListButonUserDataWithName"), [self.manager userName] ?: @"-"];
|
titleString = [NSString stringWithFormat:BITHockeyLocalizedString(@"HockeyFeedbackListButonUserDataWithName"), [self.manager userName] ?: @"-"];
|
||||||
} else if ([self.manager requireUserEmail] == BITFeedbackUserDataElementRequired ||
|
} else if ([self.manager requireUserEmail] == BITFeedbackUserDataElementRequired ||
|
||||||
([self.manager requireUserEmail] == BITFeedbackUserDataElementOptional && [self.manager userEmail] != nil)
|
([self.manager requireUserEmail] == BITFeedbackUserDataElementOptional && [self.manager userEmail] != nil)
|
||||||
) {
|
) {
|
||||||
title = [NSString stringWithFormat:BITHockeyLocalizedString(@"HockeyFeedbackListButonUserDataWithEmail"), [self.manager userEmail] ?: @"-"];
|
titleString = [NSString stringWithFormat:BITHockeyLocalizedString(@"HockeyFeedbackListButonUserDataWithEmail"), [self.manager userEmail] ?: @"-"];
|
||||||
} else if ([self.manager requireUserName] == BITFeedbackUserDataElementOptional) {
|
} else if ([self.manager requireUserName] == BITFeedbackUserDataElementOptional) {
|
||||||
title = BITHockeyLocalizedString(@"HockeyFeedbackListButonUserDataSetName");
|
titleString = BITHockeyLocalizedString(@"HockeyFeedbackListButonUserDataSetName");
|
||||||
} else {
|
} else {
|
||||||
title = BITHockeyLocalizedString(@"HockeyFeedbackListButonUserDataSetEmail");
|
titleString = BITHockeyLocalizedString(@"HockeyFeedbackListButonUserDataSetEmail");
|
||||||
}
|
}
|
||||||
[button setTitle:title forState:UIControlStateNormal];
|
actionSelector = @selector(setUserDataAction:);
|
||||||
[button addTarget:self action:@selector(setUserDataAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
||||||
} else {
|
} else {
|
||||||
topGap = 0.0f;
|
topGap = 0.0f;
|
||||||
if ([self.manager isPreiOS7Environment]) {
|
if ([self.manager isPreiOS7Environment]) {
|
||||||
@@ -513,41 +542,51 @@
|
|||||||
|
|
||||||
[button setTitleColor:BUTTON_DELETE_TEXTCOLOR forState:UIControlStateNormal];
|
[button setTitleColor:BUTTON_DELETE_TEXTCOLOR forState:UIControlStateNormal];
|
||||||
[button setTitleShadowColor:BUTTON_DELETE_TEXTCOLOR_SHADOW forState:UIControlStateNormal];
|
[button setTitleShadowColor:BUTTON_DELETE_TEXTCOLOR_SHADOW forState:UIControlStateNormal];
|
||||||
} else {
|
|
||||||
[button setTitleColor:BUTTON_DELETE_BACKGROUNDCOLOR forState:UIControlStateNormal];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[button setTitle:BITHockeyLocalizedString(@"HockeyFeedbackListButonDeleteAllMessages") forState:UIControlStateNormal];
|
titleString = BITHockeyLocalizedString(@"HockeyFeedbackListButonDeleteAllMessages");
|
||||||
[button addTarget:self action:@selector(deleteAllMessagesAction:) forControlEvents:UIControlEventTouchUpInside];
|
titleColor = BIT_RGBCOLOR(251, 35, 35);
|
||||||
|
actionSelector = @selector(deleteAllMessagesAction:);
|
||||||
}
|
}
|
||||||
|
|
||||||
[button setFrame: CGRectMake( 10.0f, topGap + 12.0f, cell.frame.size.width - 20.0f, 42.0f)];
|
if ([self.manager isPreiOS7Environment]) {
|
||||||
|
if (titleString)
|
||||||
[cell addSubview:button];
|
[button setTitle:titleString forState:UIControlStateNormal];
|
||||||
|
if (actionSelector)
|
||||||
// status label or shadow lines
|
[button addTarget:self action:actionSelector forControlEvents:UIControlEventTouchUpInside];
|
||||||
if (indexPath.section == 0) {
|
|
||||||
UILabel *statusLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 6, cell.frame.size.width, 28)];
|
|
||||||
|
|
||||||
statusLabel.font = [UIFont systemFontOfSize:10];
|
[button setFrame: CGRectMake( 10.0f, topGap + 12.0f, cell.frame.size.width - 20.0f, 42.0f)];
|
||||||
statusLabel.textColor = DEFAULT_TEXTCOLOR;
|
[cell addSubview:button];
|
||||||
statusLabel.textAlignment = kBITTextLabelAlignmentCenter;
|
} else {
|
||||||
if ([self.manager isPreiOS7Environment]) {
|
cell.textLabel.text = titleString;
|
||||||
statusLabel.backgroundColor = DEFAULT_BACKGROUNDCOLOR;
|
cell.textLabel.textColor = titleColor;
|
||||||
} else {
|
}
|
||||||
statusLabel.backgroundColor = DEFAULT_BACKGROUNDCOLOR_OS7;
|
|
||||||
|
if ([self.manager isPreiOS7Environment]) {
|
||||||
|
// status label or shadow lines
|
||||||
|
if (indexPath.section == 0) {
|
||||||
|
UILabel *statusLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 6, cell.frame.size.width, 28)];
|
||||||
|
|
||||||
|
statusLabel.font = [UIFont systemFontOfSize:10];
|
||||||
|
statusLabel.textColor = DEFAULT_TEXTCOLOR;
|
||||||
|
statusLabel.textAlignment = kBITTextLabelAlignmentCenter;
|
||||||
|
if ([self.manager isPreiOS7Environment]) {
|
||||||
|
statusLabel.backgroundColor = DEFAULT_BACKGROUNDCOLOR;
|
||||||
|
} else {
|
||||||
|
statusLabel.backgroundColor = DEFAULT_BACKGROUNDCOLOR_OS7;
|
||||||
|
}
|
||||||
|
statusLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth;
|
||||||
|
|
||||||
|
statusLabel.text = [NSString stringWithFormat:BITHockeyLocalizedString(@"HockeyFeedbackListLastUpdated"),
|
||||||
|
[self.manager lastCheck] ? [self.lastUpdateDateFormatter stringFromDate:[self.manager lastCheck]] : BITHockeyLocalizedString(@"HockeyFeedbackListNeverUpdated")];
|
||||||
|
|
||||||
|
[cell addSubview:statusLabel];
|
||||||
|
} else if (indexPath.section == 2) {
|
||||||
|
UIView *lineView1 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, cell.frame.size.width, 1)];
|
||||||
|
lineView1.backgroundColor = BORDER_COLOR;
|
||||||
|
lineView1.autoresizingMask = UIViewAutoresizingFlexibleWidth;
|
||||||
|
[cell addSubview:lineView1];
|
||||||
}
|
}
|
||||||
statusLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth;
|
|
||||||
|
|
||||||
statusLabel.text = [NSString stringWithFormat:BITHockeyLocalizedString(@"HockeyFeedbackListLastUpdated"),
|
|
||||||
[self.manager lastCheck] ? [self.lastUpdateDateFormatter stringFromDate:[self.manager lastCheck]] : BITHockeyLocalizedString(@"HockeyFeedbackListNeverUpdated")];
|
|
||||||
|
|
||||||
[cell addSubview:statusLabel];
|
|
||||||
} else if (indexPath.section == 2) {
|
|
||||||
UIView *lineView1 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, cell.frame.size.width, 1)];
|
|
||||||
lineView1.backgroundColor = BORDER_COLOR;
|
|
||||||
lineView1.autoresizingMask = UIViewAutoresizingFlexibleWidth;
|
|
||||||
[cell addSubview:lineView1];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return cell;
|
return cell;
|
||||||
@@ -577,11 +616,16 @@
|
|||||||
cell.labelText.delegate = self;
|
cell.labelText.delegate = self;
|
||||||
cell.labelText.userInteractionEnabled = YES;
|
cell.labelText.userInteractionEnabled = YES;
|
||||||
|
|
||||||
UIView *lineView1 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, cell.frame.size.width, 1)];
|
if (
|
||||||
lineView1.backgroundColor = BORDER_COLOR;
|
[self.manager isPreiOS7Environment] ||
|
||||||
lineView1.autoresizingMask = UIViewAutoresizingFlexibleWidth;
|
(![self.manager isPreiOS7Environment] && indexPath.row != 0)
|
||||||
[cell addSubview:lineView1];
|
) {
|
||||||
|
UIView *lineView1 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, cell.frame.size.width, 1)];
|
||||||
|
lineView1.backgroundColor = BORDER_COLOR;
|
||||||
|
lineView1.autoresizingMask = UIViewAutoresizingFlexibleWidth;
|
||||||
|
[cell addSubview:lineView1];
|
||||||
|
}
|
||||||
|
|
||||||
return cell;
|
return cell;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -611,10 +655,16 @@
|
|||||||
|
|
||||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||||
if (indexPath.section == 0 ) {
|
if (indexPath.section == 0 ) {
|
||||||
return 87;
|
if ([self.manager isPreiOS7Environment])
|
||||||
|
return 87;
|
||||||
|
else
|
||||||
|
return 44;
|
||||||
}
|
}
|
||||||
if (indexPath.section >= 2) {
|
if (indexPath.section >= 2) {
|
||||||
return 65;
|
if ([self.manager isPreiOS7Environment])
|
||||||
|
return 65;
|
||||||
|
else
|
||||||
|
return 44;
|
||||||
}
|
}
|
||||||
|
|
||||||
BITFeedbackMessage *message = [self.manager messageAtIndex:indexPath.row];
|
BITFeedbackMessage *message = [self.manager messageAtIndex:indexPath.row];
|
||||||
@@ -623,6 +673,17 @@
|
|||||||
return [BITFeedbackListViewCell heightForRowWithMessage:message tableViewWidth:self.view.frame.size.width];
|
return [BITFeedbackListViewCell heightForRowWithMessage:message tableViewWidth:self.view.frame.size.width];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||||
|
if (![self.manager isPreiOS7Environment]) {
|
||||||
|
if (indexPath.section == 0) {
|
||||||
|
[self newFeedbackAction:self];
|
||||||
|
} else if (indexPath.section == _userButtonSection) {
|
||||||
|
[self setUserDataAction:self];
|
||||||
|
} else if (indexPath.section == _deleteButtonSection) {
|
||||||
|
[self deleteAllMessagesAction:self];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - BITAttributedLabelDelegate
|
#pragma mark - BITAttributedLabelDelegate
|
||||||
|
|
||||||
|
|||||||
@@ -150,7 +150,11 @@
|
|||||||
#pragma mark - Feedback Modal UI
|
#pragma mark - Feedback Modal UI
|
||||||
|
|
||||||
- (BITFeedbackListViewController *)feedbackListViewController:(BOOL)modal {
|
- (BITFeedbackListViewController *)feedbackListViewController:(BOOL)modal {
|
||||||
return [[BITFeedbackListViewController alloc] initWithModalStyle:modal];
|
if ([self isPreiOS7Environment]) {
|
||||||
|
return [[BITFeedbackListViewController alloc] initWithModalStyle:modal];
|
||||||
|
} else {
|
||||||
|
return [[BITFeedbackListViewController alloc] initWithStyle:UITableViewStyleGrouped modal:modal];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)showFeedbackListView {
|
- (void)showFeedbackListView {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
@property (nonatomic, readwrite) BOOL modalAnimated;
|
@property (nonatomic, readwrite) BOOL modalAnimated;
|
||||||
|
|
||||||
- (id)initWithModalStyle:(BOOL)modal;
|
- (instancetype)initWithModalStyle:(BOOL)modal;
|
||||||
|
- (instancetype)initWithStyle:(UITableViewStyle)style modal:(BOOL)modal;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -16,8 +16,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (id)init {
|
- (instancetype)initWithStyle:(UITableViewStyle)style {
|
||||||
self = [super init];
|
self = [super initWithStyle:style];
|
||||||
if (self) {
|
if (self) {
|
||||||
_modalAnimated = YES;
|
_modalAnimated = YES;
|
||||||
_modal = NO;
|
_modal = NO;
|
||||||
@@ -25,22 +25,27 @@
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)initWithModalStyle:(BOOL)modal {
|
- (instancetype)initWithStyle:(UITableViewStyle)style modal:(BOOL)modal {
|
||||||
self = [self init];
|
self = [self initWithStyle:style];
|
||||||
if (self) {
|
if (self) {
|
||||||
_modal = modal;
|
_modal = modal;
|
||||||
|
|
||||||
//might be better in viewDidLoad, but to workaround rdar://12214613 and as it doesn't
|
//might be better in viewDidLoad, but to workaround rdar://12214613 and as it doesn't
|
||||||
//hurt, we do it here
|
//hurt, we do it here
|
||||||
if (_modal) {
|
if (_modal) {
|
||||||
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone
|
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone
|
||||||
target:self
|
target:self
|
||||||
action:@selector(onDismissModal:)];
|
action:@selector(onDismissModal:)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (instancetype)initWithModalStyle:(BOOL)modal {
|
||||||
|
self = [self initWithStyle:UITableViewStylePlain modal:modal];
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - View lifecycle
|
#pragma mark - View lifecycle
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user