This repository has been archived by the owner on May 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed EXEC_BAD_ACCESS crash when setting the detailViewController.
Also added other detail view controllers to demo each of the available presentation styles.
- Loading branch information
Bradley Bergeron
authored and
Bradley Bergeron
committed
Nov 4, 2013
1 parent
379c0cf
commit 4bb646d
Showing
13 changed files
with
517 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
SplitViewDemo/View Controllers/DrawerDetailViewController.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// | ||
// DrawerDetailViewController.m | ||
// SplitViewDemo | ||
// | ||
// Created by Bradley Bergeron on 10/25/13. | ||
// Copyright (c) 2013 Bradley Bergeron. All rights reserved. | ||
// | ||
|
||
#import "DrawerDetailViewController.h" | ||
|
||
|
||
#pragma mark - | ||
@implementation DrawerDetailViewController | ||
|
||
- (void)viewDidLoad | ||
{ | ||
[super viewDidLoad]; | ||
|
||
self.title = @"Detail View"; | ||
|
||
self.splitViewController.masterViewDisplayStyle = BDBMasterViewDisplayStyleDrawer; | ||
self.navigationItem.leftBarButtonItem = self.splitViewController.showHideMasterViewButtonItem; | ||
|
||
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) | ||
self.edgesForExtendedLayout = UIRectEdgeNone; | ||
|
||
UIFont *socialIconFont = [UIFont fontWithName:@"SSSocialCircle" size:self.websiteLabel.font.pointSize * 2.0]; | ||
|
||
NSMutableAttributedString *websiteIcon = [[NSMutableAttributedString alloc] initWithString:@"rss" | ||
attributes:@{NSForegroundColorAttributeName:self.websiteLabel.textColor, | ||
NSFontAttributeName:socialIconFont, | ||
NSLigatureAttributeName:@(2)}]; | ||
NSMutableAttributedString *twitterIcon = [[NSMutableAttributedString alloc] initWithString:@"twitter" | ||
attributes:@{NSForegroundColorAttributeName:self.twitterLabel.textColor, | ||
NSFontAttributeName:socialIconFont, | ||
NSLigatureAttributeName:@(2)}]; | ||
NSMutableAttributedString *githubIcon = [[NSMutableAttributedString alloc] initWithString:@"octocat" | ||
attributes:@{NSForegroundColorAttributeName:self.githubLabel.textColor, | ||
NSFontAttributeName:socialIconFont, | ||
NSLigatureAttributeName:@(2)}]; | ||
|
||
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle defaultParagraphStyle] mutableCopy]; | ||
paragraphStyle.lineHeightMultiple = 0.75; | ||
paragraphStyle.alignment = NSTextAlignmentCenter; | ||
|
||
NSDictionary *defaultAttributes = @{NSForegroundColorAttributeName:self.websiteLabel.textColor, | ||
NSFontAttributeName:self.websiteLabel.font, | ||
NSParagraphStyleAttributeName:paragraphStyle}; | ||
|
||
NSMutableAttributedString *websiteText = [[NSMutableAttributedString alloc] initWithString:[self.websiteLabel.text stringByReplacingOccurrencesOfString:@"website\n" withString:@"\n"] attributes:defaultAttributes]; | ||
NSMutableAttributedString *twitterText = [[NSMutableAttributedString alloc] initWithString:[self.twitterLabel.text stringByReplacingOccurrencesOfString:@"twitter\n" withString:@"\n"] attributes:defaultAttributes]; | ||
NSMutableAttributedString *githubText = [[NSMutableAttributedString alloc] initWithString:[self.githubLabel.text stringByReplacingOccurrencesOfString:@"github\n" withString:@"\n"] attributes:defaultAttributes]; | ||
|
||
[websiteText insertAttributedString:websiteIcon atIndex:0]; | ||
[twitterText insertAttributedString:twitterIcon atIndex:0]; | ||
[githubText insertAttributedString:githubIcon atIndex:0]; | ||
|
||
self.websiteLabel.attributedText = websiteText; | ||
self.twitterLabel.attributedText = twitterText; | ||
self.githubLabel.attributedText = githubText; | ||
|
||
[self.websiteLabel sizeToFit]; | ||
[self.twitterLabel sizeToFit]; | ||
[self.githubLabel sizeToFit]; | ||
} | ||
|
||
@end |
Oops, something went wrong.