diff options
author | Mikkel Krautz <mikkel@krautz.dk> | 2014-03-12 03:31:28 +0400 |
---|---|---|
committer | Mikkel Krautz <mikkel@krautz.dk> | 2014-03-12 03:31:28 +0400 |
commit | 190bffb22cccc76fabb3130797ab088045b4716a (patch) | |
tree | f47f36a3e8c07c28bd45bd875f2b93795c60af34 /Source | |
parent | a9b542647ce5cd7dbc2029992fe62a9f0c82ce05 (diff) |
MUServerViewController, MUMessageRecipientViewController: fix cell indentation on iOS 7 via newly added MUServerTableViewCell.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/Classes/MUMessageRecipientViewController.m | 7 | ||||
-rw-r--r-- | Source/Classes/MUServerTableViewCell.h | 7 | ||||
-rw-r--r-- | Source/Classes/MUServerTableViewCell.m | 36 | ||||
-rw-r--r-- | Source/Classes/MUServerViewController.m | 7 |
4 files changed, 55 insertions, 2 deletions
diff --git a/Source/Classes/MUMessageRecipientViewController.m b/Source/Classes/MUMessageRecipientViewController.m index b7f9270..8e74b8c 100644 --- a/Source/Classes/MUMessageRecipientViewController.m +++ b/Source/Classes/MUMessageRecipientViewController.m @@ -7,6 +7,7 @@ #import "MUColor.h" #import "MUOperatingSystem.h" #import "MUBackgroundView.h" +#import "MUServerTableViewCell.h" @interface MUMessageRecipientViewController () { MKServerModel *_serverModel; @@ -161,7 +162,11 @@ static NSString *CellIdentifier = @"MUMessageRecipientCell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; + if (MUGetOperatingSystemVersion() >= MUMBLE_OS_IOS_7) { + cell = [[[MUServerTableViewCell alloc] initWithReuseIdentifier:CellIdentifier] autorelease]; + } else { + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; + } } cell.textLabel.font = [UIFont systemFontOfSize:18.0f]; diff --git a/Source/Classes/MUServerTableViewCell.h b/Source/Classes/MUServerTableViewCell.h new file mode 100644 index 0000000..bd7577b --- /dev/null +++ b/Source/Classes/MUServerTableViewCell.h @@ -0,0 +1,7 @@ +// Copyright 2014 The 'Mumble for iOS' Developers. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +@interface MUServerTableViewCell : UITableViewCell +- (id) initWithReuseIdentifier:(NSString *)reuseIdentifier; +@end diff --git a/Source/Classes/MUServerTableViewCell.m b/Source/Classes/MUServerTableViewCell.m new file mode 100644 index 0000000..c411cf0 --- /dev/null +++ b/Source/Classes/MUServerTableViewCell.m @@ -0,0 +1,36 @@ +// Copyright 2014 The 'Mumble for iOS' Developers. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#import "MUServerTableViewCell.h" + +@implementation MUServerTableViewCell + +- (id) initWithReuseIdentifier:(NSString *)reuseIdentifier { + if ((self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier])) { + // ... + } + return self; +} + +- (void) layoutSubviews { + [super layoutSubviews]; + + self.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0); + + self.imageView.frame = CGRectMake( + 8 + self.indentationLevel * self.indentationWidth, + CGRectGetMinY(self.imageView.frame), + CGRectGetWidth(self.imageView.frame), + CGRectGetHeight(self.imageView.frame) + ); + + self.textLabel.frame = CGRectMake( + CGRectGetMinX(self.imageView.frame) + 40, + CGRectGetMinY(self.textLabel.frame), + CGRectGetWidth(self.frame) - (CGRectGetMinX(self.imageView.frame) + 60), + CGRectGetHeight(self.textLabel.frame) + ); +} + +@end diff --git a/Source/Classes/MUServerViewController.m b/Source/Classes/MUServerViewController.m index bd28588..b258694 100644 --- a/Source/Classes/MUServerViewController.m +++ b/Source/Classes/MUServerViewController.m @@ -8,6 +8,7 @@ #import "MUColor.h" #import "MUOperatingSystem.h" #import "MUBackgroundView.h" +#import "MUServerTableViewCell.h" #import <MumbleKit/MKAudio.h> @@ -264,7 +265,11 @@ static NSString *CellIdentifier = @"ChannelNavigationCell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; + if (MUGetOperatingSystemVersion() >= MUMBLE_OS_IOS_7) { + cell = [[[MUServerTableViewCell alloc] initWithReuseIdentifier:CellIdentifier] autorelease]; + } else { + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; + } } MUChannelNavigationItem *navItem = [_modelItems objectAtIndex:[indexPath row]]; |