objective-c

How we resize the UILabels and UITextFields automatically in auto rotation, Which are subviews of table view ?

I have table view in that I declared text fields , buttons , and label. when we change the interface orientation, the content of table view also should change with respect to the orientation. ...

How to dynamically load class in Objective-C?

Hello, how to dynamically load a class in Objective-C? As per my need, class name will be in a text file, which i need to read it, and then load the class dynamically ... This code is loading a class in Java... I want the same functionality to be done in Objective-C... public class MainClass { public static void main(String[] args)...

VoIP over 3G on iPhone, what's changed in the SDK??

Hi, I've been looking at the SDK3.2 to find out about the new capacity to direct call over IP on 3G network, but I don't see anything obvious in the API diffs. Is this just something Apple allows on a low level private framework or does it reflect on the public frameworks as well? if so, which framework, class, method? thanks for you h...

iPhone: How to Rotate a UIImageview Left or Right?

Hello all, I want to rotate an UIImageView in the following manner: If I hold the imageview and move the finger to left, then the imageview should rotate to the right (and vice-versa.) Here is the link Balance ...

Thread safe instantiation of a singleton

Which one synchronization method to use to ensure a singleton remains a singleton? +(Foo*)sharedInstance { @synchronized(self) { if (nil == _sharedInstance) { _sharedInstance = [[Foo alloc] init]; ... } } return _sharedInstance; } or using a mutex? #import <pthread.h> static pthread_mu...

How to enhance a simple NSNotificationCenter to NSNotificationQueue program?

Hi, I have done with a small program to send and receive message, i also wanted to enhance the program by giving muliple events and maintain a NSNotificationQueue? Please do give me a example.. ...

How do I access my child viewcontroller instance variable from my navigationcontroller in order to save user settings upon iphone app termination?

I'm trying to save a couple of user settings upon iphone app termination. In my AppDelegate applicationWillTerminate, I reference the child viewcontroller as follows: ChildViewController *childvc = (ChildViewController *) self.navController.topViewController; as the instance variable I'm after is in the top viewcontroller. However, ...

Reading Data from File in Objective-C

Hello, I want to read the string after delimiter from a text file in Objective-C.i'm stil struggling to get it :(.... This is wat i ve done til nw, but when i print the contents of databuffer in line 7 in code below, the data read is returning encapsulated in an NSData object.How to convert it into Readable format? NSData *databuffer;...

Objective C debugging

Hi, I was following the example on Beginning iPhone 3 Development. On Chapter 8 I made a mistake in code. - (NSMutableDictionary *)mutableDeepCopy { NSMutableDictionary * ret = [[NSMutableDictionary alloc] initWithCapacity:[self count]]; NSArray * keys = [self allKeys]; for (id key in keys) { id oneValue = [self valueForKey:k...

How to compare two date?

I have three dates: (1) previousDate (2) currentDate (3) nextDate, I want to check whether currentDate is later then previous date and earlier than nextDate. How do I do that? ...

read a line in Objective-C

Hello, i've to read a .txt file , The file lokes like, WIPRO=Class_Name1 TCS=Class_Name2 Now i want to Class_Name1 and Class_Name2.How to get this string in Objective-C? I'm not finding any function in NSString to get the index of a character.Like how we have getIndex() in C#.tel me how to proceed. ...

Textfield problem.

Hi guys, Here is a problem with my textfields. -(void)textFieldTextDidChange:(NSNotification *)notif { event.eventName = eventTextField.text; event.eventPlace = eventPlaceTextField.text; event.eventWinery = wineryTitleLabel.text; int vintageVal = [vintageTextField.text intValue]; if([vintageTextField.text length]>0 ...

iPhone SDK: dismissModalViewControllerAnimated:

Hello guys! I have an UIViewController which was displayed by invoking the presentModalViewController method and now I want to dismiss it with the dismissModalViewControllerAnimated: . Everything works fine but is there any event or a delegate method which I can catch to handle the dismissing of my UIViewController? ...

Objective-C++ Memory Problem

Hello, I'm having memory woes. I've got a C++ Library (Equalizer from Eyescale) and they use the Traversal Visitor Pattern to allow you to add new functionality to their classes. I've finally figured out how it works, and I've got a Visitor that just returns the properties from one of the objects. (since I don't know how they'r...

How can I reduce the number of annotations on a map?

I'm coding a map view with around 900 annotations. Having this many annotations on a map make the performance suffer, so I'd like to reduce it to about 300 at a time. The annotations are representing shops in a country, so they tend to cluster a lot around major cities, then in small groups of 2 or 3 in smaller towns. I want to reduce th...

How to insert multiple row of data to sqlite database by iphone programming

I am new to iphone development.I want to insert multiple values into my sqlite3 database and display the content in the tableview.I am able to insert single row of data in to my database and retrieve it and display the data but i am not able to do with inserting multiple row of data.Here is my code... -(void)initializeTableData{ sqlit...

Objective C -- is there a keypath that will cause an object to return itself?

Given an object foo of class Foo, I want to do the following: NSString *key = @"some key"; id myObj = [foo valueForKey: key]; and have myObj equal to foo. Is there a way to do this without defining a category on Foo? ...

Need help finding the leak in this code please.

#import <UIKit/UIKit.h> int main(int argc, char *argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; int retVal = UIApplicationMain(argc, argv, nil, nil);<-----This line gets highlighted as the leak [pool release]; return retVal; } It leaks right when I start the app. ...

Is there a simple way of converting an ISO8601 timestamp to a formatted NSDate?

If I use the following code: NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm"]; NSDate *myDate = [dateFormatter dateFromString:@"2010-01-28T15:22:23.863"]; NSLog(@"%@", [dateFormatter stringFromDate:myDate]); It is successfully converted to a Date object, however, I...

TDBadgedCell keeps caching the BadgeNumber

For a project I'm working on I'm using the TDBadgedCell as written by Tim Davies. While the cell works fine for the most part, the BadgeNumber keeps getting cached. I'm wondering how I can fix this. My [tableView:cellForRowAtIndexPath] message looks like this: - (UITableViewCell *)tableView:(UITableView *)_tableView cellForRowAtIndexPa...