UITableView is one of the most frequently used views of Cocoa Touch framework. We almost always use it whenever we need to display a collection of data items. There are lots of ways to customize the appearance and functionality of a UITableView to make it meet the application’s needs. Sometimes we might want to enable users to copy UITableViewCells’ content.

CopyableCell
Read more…
As all of us knows, location-aware services/applications are becoming more popular and widespread everyday. Especially, mobile devices play a very important role in that area. So we all, in some ways, need to access the location of a specific user of our app. Most of the mobile devices provides some hardware and APIs for letting application developers to access location services of the device. iPhone has a built-in GPS module and a framework is provided in Cocoa Touch called CoreLocation that is used for accessing location services of the device.
CoreLocation can be used to obtain the latitude and longitude parameters of the location of the device. But sometimes we need some more detailed information about that specific location. Country, city, state, street, may be postal code etc.. It depends on the application. That is something iPhone or iOS platform does not provide directly. However, we can use a web service such as Yahoo! PlaceFinder to access detailed information about a location of which we know the latitude and longitude parameters.
What SSLocationManager does is as follows:
- Ask CoreLocation services to determine current location of the device.
- Get current position in latitude and longitude from CoreLocation.
- Call Yahoo! PlaceFinder web service to get detailed information about the location specified with its latitude and longitude.
- Notify the application via SSLocationManagerDelegate and supply the detailed location data.
Here is a basic diagram that shows the overall structure:

SSLocationManager Diagram
Read more…
I gave a lecture on “iPhone Development” at Kadir Has University on April 26, as a guest lecturer. Here is the demo application I wrote for the lecture:
https://github.com/ardalahmet/TwitterSearchApp
It really is a simple application. It allows user to enter some text and search it on Twitter and shows results in a UITableView. It basicly demonstrates how to consume a JSON web service and how to use common UI views(UITextField, UITableview).
Git readonly url:
git://github.com/ardalahmet/TwitterSearchApp.git
Read more…
I gave a seminar on “Introduction to iPhone Development” at Kadir Has University on March 24. Here is the demo application I wrote during the seminar:
https://github.com/ardalahmet/ToDoListApp
It doesn’t do anything useful but just demonstrates some uses of common cocoa touch UI elements, some fundamental objective-c data types and basic persistence.
Git readonly url:
git://github.com/ardalahmet/ToDoListApp.git
Read more…
We all know about and use the well known -(void)presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated method of the UIViewController class, right? It does well for most of the cases, especially for displaying temporary view controllers for a limited task. We present them, they do what they’re expected to do, and we dismiss them when we’re done. An example might be a view that gets some login credentials from the user and passes those to its delegate and dismisses. But, what if we want to present a relatively smaller view, without covering the complete device screen and we also want it to be shown in a modal manner, that is, somewhat disabling the visual and functional interaction with what is behind the view for a while.
This demo project shows one of the many possible ways to do it, just to give an idea on the topic. What I implemented here is a class named ModalBoxView. It is the view to be shown modally. It supports both portrait and landscape interface orientations. Instead of trying to describe what it’s like, here it is:

A screenshot in landscape mode
Read more…
Remember how the navigation bar of Apple’s Notes application looks on iPhone? It doesn’t look like one of the system provided styles for navigation bar, neither UIBarStyleDefault nor UIBarStyleBlack. And it also looks nice and elegant, doesn’t it?
It, sometimes, would be nice to be able to change the background of the navigation bar and the color of navigation bar buttons as well. There are several ways for changing the background view of the navigation bar, one is inserting a UIImageView as a subview to the UINavigationBar at index 0. But i found this method to be a bit problematic when it comes to adapt the background view when the device interface orientation changes. Instead i create a UINavigationBar category class and override the default behaviour of the -(void)drawLayer:(CALayer *)layer inContext:(CGContextRef)context method. This alters the appearance of all UINavigationBar instances in an application-wide manner and this may be something you don’t want in some cases. However, it is really not so much difficult to use the same technique and change the appearance of UINavigationBars for individual instances. What we’ve done here may also be useful in the case you want to implement a visual theming system for your application. By dynamically changing the images we use as background, it’s possible to make UINavigationBars look different with different themes your application provides.
Read more…