objective-c

How can i simplify UIScreen width?

Hi, how can i simplify that code in one line? CGRect screen = [[UIScreen mainScreen] bounds]; NSLog(@"%@", screen.size.width); Thanks for your time. ...

Creating Network Connection through wifi in iphone.

I want to create one socket (UDP or TCP) in my iphone application for network communication. Now problem is that how can I specify myself that connection should go through wifi or GPRS or EDGE. That is when I am creating socket and sending data through it I want the user selection that data should go through which path, I do not want iPh...

Animating UIPickerView

Hi I am developing an iPhone app which uses pickerview, Upon shaking app selects one random choice. Everything works well but I was wondering is there any way to animate the UIPIckerView as Urban Spoon has done it. ...

Working flow of autorelease pool

How AutoReleasePool working in iphone? And when will be the objects released? ...

check whether given latitude and longitude is in a set of lat/lon in sqlite

In my iphone app, I have a sqlite table with latitudes and longitudes of USA(All weather stations of USA) . What is the sqlite query to check whether given latitude and longitude is in a set of lat/lon in sqlite? I mean I have the lat/lon set of New York as (42.75,73.80),(37,-122) but am searching with a lat/lon which is near New York, ...

Does static linking to STDLIB result in faster execution and loading?

I am creating a web site in Objective-C, running with CGI and Apache, and, because people don't have patience, I want to create it as fast as possible. So the main question: Does static linking result in faster loading than dynamic linking? Of course, the binary will be bigger, but.. the system has to read less files. P.S. I do care...

checking if a textfield is null

I currently add objects to an array with a label taken from the textfield input from the user. At the moment it adds an entry even if the field is blank. I assign the textfield to a string and then want to check if it is nil, if it is then dont add it to the array. I am used to java where it could be done with something like if(enter...

NSPredicate help

NSPredicate *pred = [NSPredicate predicateWithFormat:@"firstname contains[cd] %@" argumentArray:firstNames]; NSArray *ar = [contactList filteredArrayUsingPredicate:pred]; What I want is to filter the contact list matching the values in the firstNames array. But this always results one element even if there are multiple matches? ...

get compile timestamp iphone sdk

How can i get the timestamp of when an application was compiled for iphone At the moment I've got this method on my app delegate - (NSDate*) compiledAt { NSDateFormatter *k= [[NSDateFormatter alloc] init]; [k setDateFormat:@"MMM d yyyy HH:mm:ss"] ; NSString *dateString = [[[NSString stringWithUTF8String:__DATE__] stringByAp...

Animate between two states of a view, using custom animation

Hi, I would like to animate between two states of a view. Say, for example, I have a view with a label and when I change the text of the label an animation renders that change as a page flipping. Now you can of course do this with a [UIView setAnimationTransition:forView:cache:]: - (IBAction)nextPage { [UIView beginAnimation:nil...

how to search nsmutable array in objective C

Hi all, can any body tell me how to search NSMutable Arry in which objects are stored from xml feed i have the following code - (void) searchTableView { NSString *searchText = searchBar.text; NSMutableArray *searchArray = [[NSMutableArray alloc] init]; //blog entries is the nsmutable array in which objects are stored from RSS feed f...

addObserver questions, try to check if data is loaded

I have a ViewController that initializes another class that loads data into a mutable array and saves it as a property on itself. here is my ViewController init code: -(id) initWithCollectionID:(NSString *)aCollectionID { if (self = [super init]){ collectionID=aCollectionID; dataSource = [[CollectionListDataSource...

iPhone: Reading App Executable as a File

I have tried to read the main application via several methodes but i got nothing back Using NSFileHandle it returns nothing with the folowing code : NSFilemanager *filemanager = [ filemanager defaultmanager ] ; NSString *myfile = [ [ NSBundle mainBundle ] bundlePath ] ; if ( [ filemanager isReadableFileAtPath:myfile ] ) NS...

Get textField.text from custom UITableViewCell

Hi, I wrote a Special UITableViewCell. Now I need to get the text out of a textfield in - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { CustomCell *custumCell = [tableView cellForRowAtIndexPath:indexPath]; //warning: incompatible Objective-C types initializing 'struct UITableViewCell *...

How to handle setDelegate: when using multipe threads

Hi all, I've come across an issue with using a third party library, and am not sure what the common pattern to solve it is. I'm using the asi-http-request class, which fetches http objects asynchronously using a thread. In my objects dealloc() method, I do [request setDelegate:nil]; [request release]; However the delegate is someti...

Problem with Tiny URL

Hi Guys! I am developing Twitter API to my application. In my app, I want to display the tiny url with parsed xml link in UITexField as dynamically. statically, I could able to display tiny url in UITextField, but dynamically I am not able to display the tiny url. Please help me! Code: statically(Working fine), NSURL *url = [NSURL UR...

NSPredicate issue

Hello everyone, I have 2 tables, 1 table is called table car and 2nd is called history. A car can have many histories so basically a history will have a foreign key carid which represents the car id. I am trying to extract all the history that is associated with the car but unfortunately, it keeps returning me every single history. ...

trying to obtain an objects title variable gives unrecognized selector sent to instance

I have an object which holds a title and an indexReference. I save the object to an array and that works correctly. I then try to load from the array and populate the tableview. I use this code. //fill it with contents SavedFav *temp = [tableViewData objectAtIndex:indexPath.row]; cell.textLabel.text = temp.title; I then get an err...

Serialization with objective-c

Hi, I'm doing a iphone application and when the user quit the application and return in the application later, I want he return at the same place in the application before he quit. How I do this? Is it serialization? thanks Alex ...

How to hide UITabBarController

HI, I have listController, detailsController and editController. I need to hide UITabBarController for DetailsController only not for all other controllers.I used below code. ListController.m - (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { detailsController* detailViewController = [[de...