Skip to content

Commit

Permalink
MUServerViewController, MUMessageRecipientViewController: fix cell in…
Browse files Browse the repository at this point in the history
…dentation on iOS 7 via newly added MUServerTableViewCell.
  • Loading branch information
mkrautz committed Mar 11, 2014
1 parent a9b5426 commit 190bffb
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 2 deletions.
6 changes: 6 additions & 0 deletions Mumble.xcodeproj/project.pbxproj
Expand Up @@ -115,6 +115,7 @@
28BE998018CFA83800910551 /* BlackToolbarPatterniOS7@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 28BE997F18CFA83800910551 /* BlackToolbarPatterniOS7@2x.png */; };
28BE998218CFA8B900910551 /* BlackToolbarPatterniOS7.png in Resources */ = {isa = PBXBuildFile; fileRef = 28BE998118CFA8B900910551 /* BlackToolbarPatterniOS7.png */; };
28BE998518CFB96A00910551 /* MUHorizontalFlipTransitionDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 28BE998418CFB96A00910551 /* MUHorizontalFlipTransitionDelegate.m */; };
28BE998818CFCDE600910551 /* MUServerTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 28BE998718CFCDE600910551 /* MUServerTableViewCell.m */; };
28BF81D2139AFFD50078B722 /* MUCertificateDiskImportViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28BF81D1139AFFD50078B722 /* MUCertificateDiskImportViewController.m */; };
28C1034716EFB1C100DECE08 /* MUActionSheet.m in Sources */ = {isa = PBXBuildFile; fileRef = 28C1034216EFB1C100DECE08 /* MUActionSheet.m */; };
28C1034816EFB1C100DECE08 /* MUActionSheetBackgroundView.m in Sources */ = {isa = PBXBuildFile; fileRef = 28C1034416EFB1C100DECE08 /* MUActionSheetBackgroundView.m */; };
Expand Down Expand Up @@ -400,6 +401,8 @@
28BE998118CFA8B900910551 /* BlackToolbarPatterniOS7.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = BlackToolbarPatterniOS7.png; path = Resources/BlackToolbarPatterniOS7.png; sourceTree = "<group>"; };
28BE998318CFB96A00910551 /* MUHorizontalFlipTransitionDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MUHorizontalFlipTransitionDelegate.h; sourceTree = "<group>"; };
28BE998418CFB96A00910551 /* MUHorizontalFlipTransitionDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MUHorizontalFlipTransitionDelegate.m; sourceTree = "<group>"; };
28BE998618CFCDE600910551 /* MUServerTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MUServerTableViewCell.h; sourceTree = "<group>"; };
28BE998718CFCDE600910551 /* MUServerTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MUServerTableViewCell.m; sourceTree = "<group>"; };
28BF81D0139AFFD50078B722 /* MUCertificateDiskImportViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MUCertificateDiskImportViewController.h; sourceTree = "<group>"; };
28BF81D1139AFFD50078B722 /* MUCertificateDiskImportViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MUCertificateDiskImportViewController.m; sourceTree = "<group>"; };
28C1034116EFB1C100DECE08 /* MUActionSheet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MUActionSheet.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -624,6 +627,8 @@
280D9AD913EAFAAE003B64A0 /* MUServerRootViewController.m */,
289CBA16125693040015E58E /* MUServerViewController.h */,
289CBA17125693040015E58E /* MUServerViewController.m */,
28BE998618CFCDE600910551 /* MUServerTableViewCell.h */,
28BE998718CFCDE600910551 /* MUServerTableViewCell.m */,
28A2AEBF14788BE300F3B83F /* MUColor.h */,
28A2AEC014788BE300F3B83F /* MUColor.m */,
28F79C6E147973D40003B8BA /* MUUserStateAcessoryView.h */,
Expand Down Expand Up @@ -1361,6 +1366,7 @@
28F08362147F263C00DC126F /* MUAudioBarView.m in Sources */,
28F08365147F369200DC126F /* MUAudioBarViewCell.m in Sources */,
286E9260148452A000B13593 /* MUVoiceActivitySetupViewController.m in Sources */,
28BE998818CFCDE600910551 /* MUServerTableViewCell.m in Sources */,
2822AC0614878AC500E9DB17 /* MUConnectionController.m in Sources */,
28F04B2214898A7100C90909 /* MUAdvancedAudioPreferencesViewController.m in Sources */,
28ADA303148A3E3B00C55E51 /* MUAudioQualityPreferencesViewController.m in Sources */,
Expand Down
7 changes: 6 additions & 1 deletion Source/Classes/MUMessageRecipientViewController.m
Expand Up @@ -7,6 +7,7 @@
#import "MUColor.h"
#import "MUOperatingSystem.h"
#import "MUBackgroundView.h"
#import "MUServerTableViewCell.h"

@interface MUMessageRecipientViewController () {
MKServerModel *_serverModel;
Expand Down Expand Up @@ -161,7 +162,11 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
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];
Expand Down
7 changes: 7 additions & 0 deletions 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
36 changes: 36 additions & 0 deletions 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
7 changes: 6 additions & 1 deletion Source/Classes/MUServerViewController.m
Expand Up @@ -8,6 +8,7 @@
#import "MUColor.h"
#import "MUOperatingSystem.h"
#import "MUBackgroundView.h"
#import "MUServerTableViewCell.h"

#import <MumbleKit/MKAudio.h>

Expand Down Expand Up @@ -264,7 +265,11 @@ - (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(
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]];
Expand Down

0 comments on commit 190bffb

Please sign in to comment.