Differentiating table header height in iPad

This commit is contained in:
Roy Yang 2012-06-07 13:37:23 -07:00
parent 4afaad02de
commit e638a3681d
3 changed files with 39 additions and 23 deletions

View file

@ -474,15 +474,27 @@
- (UIView *)tableView:(UITableView *)tableView
viewForHeaderInSection:(NSInteger)section {
int headerLabelHeight, folderImageViewY, disclosureImageViewY;
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad){
headerLabelHeight = 30;
folderImageViewY = 7;
disclosureImageViewY = 8;
}else{
headerLabelHeight = 20;
folderImageViewY = 2;
disclosureImageViewY = 3;
}
// create the parent view that will hold header Label
UIControl* customView = [[[UIControl alloc]
initWithFrame:CGRectMake(0.0, 0.0,
tableView.bounds.size.width, 21.0)]
tableView.bounds.size.width, headerLabelHeight + 1)]
autorelease];
UIView *borderBottom = [[[UIView alloc]
initWithFrame:CGRectMake(0.0, 20.0,
initWithFrame:CGRectMake(0.0, headerLabelHeight,
tableView.bounds.size.width, 1.0)]
autorelease];
borderBottom.backgroundColor = [UIColorFromRGB(0xB7BDC6) colorWithAlphaComponent:0.5];
@ -496,7 +508,7 @@
headerLabel.textColor = [UIColor colorWithRed:0.3 green:0.3 blue:0.3 alpha:1.0];
headerLabel.highlightedTextColor = [UIColor whiteColor];
headerLabel.font = [UIFont boldSystemFontOfSize:11];
headerLabel.frame = CGRectMake(36.0, 1.0, 286.0, 20.0);
headerLabel.frame = CGRectMake(36.0, 1.0, 286.0, headerLabelHeight);
headerLabel.shadowColor = [UIColor colorWithRed:.94 green:0.94 blue:0.97 alpha:1.0];
headerLabel.shadowOffset = CGSizeMake(0.0, 1.0);
if (section == 0) {
@ -513,13 +525,13 @@
UIImage *folderImage = [UIImage imageNamed:@"folder.png"];
UIImageView *folderImageView = [[UIImageView alloc] initWithImage:folderImage];
folderImageView.frame = CGRectMake(14.0, 2.0, 16.0, 16.0);
folderImageView.frame = CGRectMake(14.0, folderImageViewY, 16.0, 16.0);
[customView addSubview:folderImageView];
[folderImageView release];
UIImage *disclosureImage = [UIImage imageNamed:@"disclosure.png"];
UIImageView *disclosureImageView = [[UIImageView alloc] initWithImage:disclosureImage];
disclosureImageView.frame = CGRectMake(customView.frame.size.width - 20, 3.0, 9.0, 14.0);
disclosureImageView.frame = CGRectMake(customView.frame.size.width - 20, disclosureImageViewY, 9.0, 14.0);
[customView addSubview:disclosureImageView];
[disclosureImageView release];
@ -553,7 +565,11 @@
// if ([[folder stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] length] == 0) {
// return 0;
// }
return 21;
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad){
return 31;
}else{
return 21;
}
}
- (void)didSelectSectionHeader:(UIButton *)button {

View file

@ -176,7 +176,7 @@
<string key="NSFrame">{{209, 113.5}, {350, 29}}</string>
<reference key="NSSuperview" ref="973185930"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="947146700"/>
<reference key="NSNextKeyView" ref="382037909"/>
<string key="NSReuseIdentifierKey">_NS:262</string>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
<int key="IBSegmentControlStyle">2</int>
@ -275,7 +275,7 @@
<int key="IBUIContentVerticalAlignment">0</int>
<string key="IBUIText"/>
<int key="IBUIBorderStyle">3</int>
<string key="IBUIPlaceholder">Choose a folder</string>
<string key="IBUIPlaceholder">Choose the parent folder</string>
<object class="NSColor" key="IBUITextColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes>
@ -329,7 +329,7 @@
<string key="NSFrame">{{215, 224}, {20, 20}}</string>
<reference key="NSSuperview" ref="973185930"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="359716653"/>
<reference key="NSNextKeyView" ref="133572282"/>
<string key="NSReuseIdentifierKey">_NS:824</string>
<reference key="IBUIBackgroundColor" ref="346851231"/>
<bool key="IBUIClipsSubviews">YES</bool>
@ -376,7 +376,7 @@
<bool key="IBUIMultipleTouchEnabled">YES</bool>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
</object>
<object class="IBUILabel" id="947146700">
<object class="IBUILabel" id="382037909">
<reference key="NSNextResponder" ref="973185930"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{220, 189}, {50, 21}}</string>
@ -394,13 +394,13 @@
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
<float key="IBUIMinimumFontSize">10</float>
<object class="IBUIFontDescription" key="IBUIFontDescription" id="832394896">
<object class="IBUIFontDescription" key="IBUIFontDescription" id="638475919">
<int key="type">1</int>
<double key="pointSize">17</double>
</object>
<reference key="IBUIFont" ref="24658222"/>
</object>
<object class="IBUILabel" id="359716653">
<object class="IBUILabel" id="133572282">
<reference key="NSNextResponder" ref="973185930"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{220, 291}, {50, 21}}</string>
@ -418,7 +418,7 @@
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
<float key="IBUIMinimumFontSize">10</float>
<reference key="IBUIFontDescription" ref="832394896"/>
<reference key="IBUIFontDescription" ref="638475919"/>
<reference key="IBUIFont" ref="24658222"/>
</object>
</object>
@ -5084,8 +5084,8 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
<reference ref="151912820"/>
<reference ref="782639577"/>
<reference ref="919711053"/>
<reference ref="947146700"/>
<reference ref="359716653"/>
<reference ref="382037909"/>
<reference ref="133572282"/>
<reference ref="622270256"/>
<reference ref="450177912"/>
</object>
@ -5187,12 +5187,12 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
</object>
<object class="IBObjectRecord">
<int key="objectID">70</int>
<reference key="object" ref="947146700"/>
<reference key="object" ref="382037909"/>
<reference key="parent" ref="973185930"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">71</int>
<reference key="object" ref="359716653"/>
<reference key="object" ref="133572282"/>
<reference key="parent" ref="973185930"/>
</object>
</object>

View file

@ -116,13 +116,13 @@
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">12</float>
<int key="IBUINumberOfLines">2</int>
<object class="IBUIFontDescription" key="IBUIFontDescription" id="960020026">
<object class="IBUIFontDescription" key="IBUIFontDescription" id="968270764">
<string key="name">Helvetica-Bold</string>
<string key="family">Helvetica</string>
<int key="traits">2</int>
<double key="pointSize">15</double>
</object>
<object class="NSFont" key="IBUIFont" id="125712816">
<object class="NSFont" key="IBUIFont" id="540559276">
<string key="NSName">Helvetica-Bold</string>
<double key="NSSize">15</double>
<int key="NSfFlags">16</int>
@ -209,7 +209,7 @@
<object class="IBUIView" id="111782255">
<reference key="NSNextResponder" ref="247257992"/>
<int key="NSvFlags">290</int>
<string key="NSFrameSize">{1024, 20}</string>
<string key="NSFrame">{{0, -1}, {1004, 20}}</string>
<reference key="NSSuperview" ref="247257992"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="1001310564"/>
@ -271,8 +271,8 @@
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">12</float>
<int key="IBUINumberOfLines">2</int>
<reference key="IBUIFontDescription" ref="960020026"/>
<reference key="IBUIFont" ref="125712816"/>
<reference key="IBUIFontDescription" ref="968270764"/>
<reference key="IBUIFont" ref="540559276"/>
<bool key="IBUIAdjustsFontSizeToFit">NO</bool>
</object>
<object class="IBUILabel" id="450494992">
@ -475,10 +475,10 @@
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="1001310564"/>
<reference ref="111782255"/>
<reference ref="753396836"/>
<reference ref="450494992"/>
<reference ref="607536273"/>
<reference ref="111782255"/>
</object>
<reference key="parent" ref="0"/>
</object>