Permalink
Browse files

Use entire width of dashboard on iPad to display text

  • Loading branch information...
1 parent 0d634b6 commit 48d27f8b414a4262c931877c94838c1aced8ea4f @gonfunko committed Apr 28, 2012
@@ -52,11 +52,6 @@
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
- <AdditionalOption
- key = "NSZombieEnabled"
- value = "YES"
- isEnabled = "YES">
- </AdditionalOption>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
@@ -188,7 +188,13 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa
if (indexPath.row == 0) {
GMDashboardItem *item = [[[[GMDataSource sharedDataSource] currentCourse] dashboardItems] objectAtIndex:indexPath.section];
//Based on http://stackoverflow.com/questions/2669063/how-to-get-the-size-of-a-nsstring
- CGSize maximumSize = CGSizeMake(300, 9999);
+ CGSize maximumSize;
+ if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
+ maximumSize = CGSizeMake(300, 9999);
+ } else {
+ maximumSize = CGSizeMake(self.tableView.bounds.size.width - 20, 9999);
+ }
+
CGSize stringSize = [item.contents sizeWithFont:[UIFont fontWithName:@"Helvetica" size:16.0]
constrainedToSize:maximumSize
lineBreakMode:UILineBreakModeWordWrap];
@@ -217,11 +223,18 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
if (indexPath.row == 0) {
((GMTextViewTableCell *)cell).textView.text = item.contents;
- CGSize maximumSize = CGSizeMake(300, 9999);
+ CGRect textViewFrame = ((GMTextViewTableCell *)cell).textView.frame;
+ CGSize maximumSize;
+ if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
+ maximumSize = CGSizeMake(300, 9999);
+ } else {
+ maximumSize = CGSizeMake(self.tableView.bounds.size.width - 20, 9999);
+ }
+
CGSize stringSize = [item.contents sizeWithFont:[UIFont fontWithName:@"Helvetica" size:16.0]
constrainedToSize:maximumSize
lineBreakMode:UILineBreakModeWordWrap];
- CGRect textViewFrame = ((GMTextViewTableCell *)cell).textView.frame;
+
((GMTextViewTableCell *)cell).textView.frame = CGRectMake(textViewFrame.origin.x, textViewFrame.origin.y, textViewFrame.size.width, stringSize.height + 10);
} else {
cell.textLabel.text = [[[item links] objectAtIndex:indexPath.row - 1] objectForKey:@"title"];
@@ -26,6 +26,15 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
return self;
}
+- (void)setFrame:(CGRect)frame {
+ [super setFrame:frame];
+ if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) {
+ self.textView.frame = CGRectMake(frame.origin.x, 0, frame.size.width, frame.size.height);
+ } else {
+ self.textView.frame = CGRectMake(frame.origin.x, 0, frame.size.width, frame.size.height);
+ }
+}
+
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];

0 comments on commit 48d27f8

Please sign in to comment.