Here’s my favorite iPad Project Template. Modified for 6 view controllers, split view, master tableview uses sections, and is in group format!
Posts Tagged ‘ipad’
iPhoneOS SDK – iPad Design Template – Multiple Views with Group Table View as the Master View Controller
iPhoneOS SDK – iPad Popover Controller
The iPad Popover control is possibly the least publicized feature of the iPhoneOS SDK, but becomes critical to in app actions and workflows. This is because the Popover Controller can show a small UIView of controls and more importantly save the user from having the whole screen change navigation hierarchy. A simple popover for example, can be used to edit a textfield, or change a date really quickly. In an iPhone app, this would typically be done by sending the user to a ‘DetailView’ where the setting/property can be change, whereas on the iPad this is highly discouraged. I am going to go through a quick popover example today, and on monday I will post a fantastic iPad user template.
1. Understanding the context
First, you need to know where a popover should be used. I can’t say much more than whats above. Use the apple apps, use the other top 100 apps, see how they use the popover controller. This will give you a feel of what it should do.
2. Some Code
Firstly, your main view controller {.h} needs a <UIPopoverControllerDelegate> declaration.
In your main view controller, add the following to the @interface (.h file)
//PopoverViewController
UIPopoverController *popoverController;
and just before @end add an IBAction:
- (IBAction)popOverViewCall:(id)sender;
Create a New View & ViewController {.h/.m} files and place them in your project. This is the actual popover that will come up. Place controls how ever you see fit. I call this popover controller MyViewControllerForPopover. Add an include of this file to your main view controller, eg:
#import “FirstDetailViewControllerPopOverControl.h”
In MyViewControllerForPopop {.m file}, add the following code:
-(void)viewDidAppear:(BOOL)animated
{
self.contentSizeForViewInPopover = CGSizeMake(320,320);
}
This sets the size of the popover for showing.Go into interface builder and add a couple controls to ensure you know when it works.
And finally in your main view controller {.m file}, add the IBAction:
-(IBAction)popOverViewCall:(id)sender{
FirstDetailViewControllerPopOverControl *myViewControllerForPopover = [[FirstDetailViewControllerPopOverControl alloc] initWithNibName:@”FirstDetailViewControllerPopOverControl” bundle:nil ];
UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:myViewControllerForPopover];
self.popoverController = popover;
popoverController.delegate = self;
[popover release];
[myViewControllerForPopover release];
CGPoint point = {200,200}; // Place to put on screen
CGSize size = {600,600}; // A content range (see apple docs)
[popoverController presentPopoverFromRect:CGRectMake(point.x, point.y, size.width, size.height)
inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
Add a button on your main view controller to call the IBAction. That covers it! One of the new features in iPhoneOS3.2 for iPad. See the screenshots for how it should look, code is downloadable below.

![]() |
 |
iPhone OS SDK – Tableview Text and Subtitle with Image using Indent
Today I am posting something small which adds a great touch to a UITableViewCell. I would like to show you how to add an image to the left of a tableview cell, in the minimum amount of code (realistically) possible.
Firstly I am using the TableViewStyle UITableViewCellStyleSubtitle Which is great for a main row of text and a smaller row of text underneath.
UITableViewCellStyleSubtitle – Subtitle Row Style
First the visual output:

and the code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @”CellIdentifier”;
// Dequeue or create a cell of the appropriate type.
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
}
cell.detailTextLabel.text = tempName;
cell.textLabel.text = tempProject;
}
But I would like to add an image to the left side. In the past I have Created three custom views ontop of each cell, and then for each cell, set a number of properties and inserted the text/image. This was all created and deallocated automatically.
I have found an even simpler way to do all of this. It uses the fantastic property ‘indentationWidth’
UITableViewCellStyleSubtitle – Subtitle Row Style with Image
First the output pic:

And the code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @”CellIdentifier”;
// Dequeue or create a cell of the appropriate type.
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.selectionStyle = UITableViewCellSelectionStyleBlue;
//Indentation Code.
cell.indentationLevel = 1;
cell.indentationWidth = 30;
CGRect frame; frame.origin.x = 5; frame.origin.y = 5; frame.size.height = 32; frame.size.width = 32;
//Print Icon
UIImageView *imgLabel = [[UIImageView alloc] initWithFrame:frame];
imgLabel.tag = 1000;
[cell.contentView addSubview:imgLabel];
[imgLabel release];
}
cell.detailTextLabel.text = tempName;
cell.textLabel.text = tempProject;
//Setup Pic in Cell
UIImageView *imageView = (UIImageView *) [cell.contentView viewWithTag:1000];
imageView.image = [UIImage imageNamed:@"ico-project.png"]; // set the image for the imageview
}
This is a vast improvement to what I have previously used and have seen online.
I Hope this is found to be useful!
Announcing DesignBrief for iPad
![]()
My first iPad application Design Brief is now available for sale! Design Brief is based around the idea of asking a new client the right questions to generate a broad and descriptive design brief, either for a website or graphic designer.
The application was developed over 2 months and is a fantastic tool for a creative studio.
The official website is http://apps.duivesteyn.net/DesignBrief
The official twitter account is twitter.com/DesignBrief, but for support and all things de-apps twitter.com/de_applications should be used.
All feedback and comments received will be noticed, all problems will be replied to and all feature requests will be given consideration.
The initial sale price is just $2.49 available for the first 2 weeks only.
iPhone/iPad Development – Screen Rotation Resizing

There comes a time in many apps where the screen will be rotated and the view will resize to the new screen layout. This will be even more important when it comes to the iPad which recommends that the app is usable on all different orientations.
On rotation, I call a method that then goes and tediously shuffles the frames of all my onscreen items for landscape, and then it needs to be done again when going back to portrait. (There should be a class out there somewhere which automates all this).
The important part is getting the X,Y,Width,Height data of all the frames of the objects and I have lately adapted code to generate the following:
if ([[self.view subviews] count] > 0) { <br />
NSLog(@"Enumerating Subview Details\n%@",[self.view subviews]); <br />
}
<p>What is does is print (to NSLog) a list of all the subviews in the main view. It makes getting the frame X,Y,W,H data much faster. Hope it helps!</p>
iPhone iPad Development – Quick – TableView Properties
I am currently working on supporting multi orientations of the iPhone (iPad) Screen, where on rotation some objects will be resized and others will be moved. For example I am wanting to move a tableView object and I want to ensure when I rotate back to Portrait that the tableview ends up in the exact same place before I moved it.
I came up with some quick debug code you can use in your iPhone App Development (or iPad App development).
The idea is you get the H,W,X,Y co-ordinates and can then later perfectly replace the initial properties.
Run this in viewDidAppear (for example)
int height = tableView.frame.size.height;
int width = tableView.frame.size.width;
int x = tableView.frame.origin.x;
int y = tableView.frame.origin.y;
NSLog(@”TableView Height:%d”,height);
NSLog(@”TableViewWidth:%d”,width);
NSLog(@”TableViewX:%d”,x);
NSLog(@”TableViewY:%d”,y);
Then later in willRotateToInterfaceOrientation you can use the code:
tableView.frame = CGRectMake(x, y, w, h); //where x,y are the frame origin coordinates (x,y) and w,h are the width and height of the frame
iPhone UI – Best UI Elements I have seen
This post is also a deviation from the norm, an ever updating page of iPhone/iPad OS elements that I really like.
- Barnes and Noble – Beautiful Layered Interface (img from smashingmagazine.com)
- Tweetie2 – Beautiful Layered Interface (img from smashingmagazine.com)


























