Get Updates By E-mail 

uitableview

3 Great Tutorials For Beginning iOS Developers

  •  
  •  
  •  
  •  
  •  

Beginning iPhone development can be rough, especially if you’re not a professional developer.

I know that searches for beginner tutorials are common on this website and I have moved away from “how to get started” material into talking about development libraries, and more advanced developer tutorials — while I will be putting more up for beginners in the future I’d like to point beginners out to a new resource.

That resource is from one of this site’s active commenters Nick Vellios.  Thanks to Nick’s comments I visited his site several times and noticed it had become a growing resource for those getting started with the iPhone and iPad sdk.

Nick has created several tutorials for absolute beginners featuring sample code, step-by-step instruction, and detailed screenshosts.  Some of the resources include:

Final one isn’t really a tutorial but it’s great if you get the Stanford CS193p course on iTunes.

And several other snippets, tutorials, and sample code for beginners ios developers.

Be sure to check it out if you are a beginner looking for help.

If you find something you like then please share it with others using the buttons below.  Thanks!


  •  
  •  
  •  
  •  
  •  

4 Ridiculously Handy Custom iPhone UI Tricks and Libraries

  •  
  •  
  •  
  •  
  •  

The iPhone has a great UI library, but there are still times when you think to yourself when programming — why didn’t they include this feature?

Whenever that thought pops into my head (probably because I’m an efficiency freak who likes to do things in the least possible time) and I can’t easily find the answer in Apple’s documentation I look to see if someone has done it before, and shared their results.

Hans Pinckaers, an 18 year old developer from the Netherlands submitted in a collection of several tips and custom UI classes that he has put together.

They include:

1. A multiline/auto-resizing UITextView element which operates similar to the SMS app. (here)

2. How to perform a custom action when the user presses a UIBackButton. (here)

3. A High performance rounded corner UITableView implementation. (here)

4. How to create a copyable UITableViewCell. (here)

Btw, if you’ve seen a good iOS tip feel free to submit it, or a link to it here and if I think the readers will like it I’ll feature it on the site in front of our 2,000+ daily visitors.


  •  
  •  
  •  
  •  
  •  

Getting The Most Out Of The Three20 Open Source Library

  •  
  •  
  •  
  •  
  •  

I mentioned the Three20 open source library many months ago as a quick way to perform many utility operations within your app quickly such as photo-viewing, creating stylized buttons, and http caching.

Since then I’ve come across several tutorials that have really helped get more out of this library, and add some pretty cool functionality to iPhone apps.

First of all, the best place to find out how to use and do more with Three20 is the Three20 Google Group.  These guys continuously share tips, and will answer all your questions about the library.

A couple of super useful tutorials that I’ve found are from Matt Vague:

Three20 Stylesheets – enables you to CSS like stylesheets within your apps.
Three20 TTTableItemTutorial – Make very cool custom tableview cells.

If you’re just getting started Ray Wenderlich, the creator of the Space Game Starter Kit and co-author of the Learning Cocos2D book, has created a very straightforward beginners tutorial: Introduction To Three20

This is a very cool utility library that you will want to check out if you haven’t.


  •  
  •  
  •  
  •  
  •  

How To Make Ultra-Slick Gradient UITableView Cells

  •  
  •  
  •  
  •  
  •  

Editor’s Note: You’ve seen the slick supercool gradient UITableView backgrounds, and this is how to make them quick and easy.  Thanks to Brett Romero of Cygen for this tutorial, ManiacDev.Com’s first submitted tutorial.  If you’ve created a quality, original tutorial that you think iPhone developers might want to read about please e-mail [email protected]
– Johann Dowa, ManiacDev.Com
 
This demonstration provides an example of how to spice up your UITableView rows for a more polished look. In addition to seeing how easy it can be to design a nice graphic for your iPhone app, you get a start to finish implementation.


The finished product is shown below.

 

Rather than sticking with stock components included in Interface Builder, this demonstration shows a simple technique that gives your app a more professional look. As a developer, it can be difficult to create nice looking graphics for your app. Hiring a designer can quickly exceed the budget. However, creating some nice looking graphics is certainly achievable as a beginning designer. In addition to picking up some new great skills, a polished off UI can lend more creditability to your app and provide an overall better user experience.

In the demo, Photoshop Elements is used, which is 80 bucks at adobe.com with a mail-in rebate. To get started, create a new image with these values:

  • Width: 80 pixels
  • Height: 40 pixels
  • Background Contents: Transparent

Select a foreground color from the toolbar, as shown below:

 

 

Now select the gradient button, as shown below:

 

 

With the gradient selected, swipe from bottom to top on your image. This should produce a gradient color. Now choose File and “Save for Web”. You’ve just created the image we’ll use in our tableview. Let’s switch over to Xcode and implement the image.

In Xcode, we start by creating a navigation based application.

Once the application has been created, add the newly created image by right clicking the Resources folder then “Add” and “Existing Files”, as shown below:

 

 

 

 

The following code snippet creates two views. Both are then added to the cell’s view. Because the label, which is a view, is added as the last view, we need to ensure its background is transparent (clearColor). Otherwise, it will cover part or all (depending on the size we set) of our background image. Thinking about what this stack of layers will look like, below is a screenshot of the same scenario in Interface Builder:

 

 

From the screenshot, you can see the cell’s view owns the imageview and label. Although closer to the bottom, the label is actually top most to the user, hence the reason we need its background to clear.

Let’s take a look at the implementation in Xcode, which is all done in the UITableView delegate method cellForRowAtIndexPath:.

UIImage *image = [UIImage imageNamed:@"gradientcolor.png"];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
imageView.contentMode = UIViewContentModeScaleToFill;
cell.backgroundView = imageView;
[imageView release];

UILabel *label = [[UILabel alloc] init];
label.text = @"testing colors";
label.frame = cell.bounds;
label.backgroundColor = [UIColor clearColor];
label.textAlignment = UITextAlignmentCenter;
[cell addSubview:label];
return cell;

In the above snippet, we create an image object using the image we added to our app bundle. Next, we create a UIImageView object with the newly created image. The image view will be assigned to our cell’s background view. The backgroundView will retain an instance of the imageView. Therefore, we release our instance, as follows:

[imageView release];

If we had not released our instance, we’d have two instances of the imageView in memory and thus a memory leak. Moving on down in the code, we create an instance of a label. We set the label’s size to cover the entire cell. The label’s background is set to clear or transparent so it doesn’t hide the cell’s background image. Our assigned text is centered and finally, we add the label to the cell’s view, making it the top most view in the cell.

By Brett Romero
See similar articles in sdkIQ

  •  
  •  
  •  
  •  
  •