objective-c

How can one address controls dynamically in obj-c?

For instance I have created a view with 50 sequential buttons named btn1-btn50. If I want to address these buttons and make some changes to them in a loop how can I address the controls with a string name? ...

Adding subviews programatically on iPad, hard coding help

I'm adding a custom status bar in my application to monitor upload progress. This works fine in portrait mode, but when I am in landscape and my custom status bar appears, it always appears on the opposite side of the home button. I think it's because I'm hard coding my frame. I have the XIB file set to auto adjust its length. take a...

How do I incorporate WebDAV into my iPhone application?

I would like to add WebDAV to my iPhone application. What is the best way / library to enable this? ...

Can a UINavigationController contain a UITabbarController?

I want to have a UIView inside of a NavigationController that has 4 buttons. Clicking on any of these 4 buttons will push a UITabBarController that contains a NavigationController with a respective UIView. Is this possible? Tweetie seems to do something similar. ...

What is the difference between UITabBar and UITabBarController?

What is the difference between UITabBar and UITabBarController? When is it more beneficial to use one over the other? ...

UITabBarController does not appear in view

I have a UIView that is pushing a UITableViewController that is contained inside of a UITabBarController. #import <UIKit/UIKit.h> @interface ARViewController : UITableViewController<UITabBarControllerDelegate> { IBOutlet UITabBarController* tabBarController; } @property(nonatomic,retain)IBOutlet UITabBarController* tabBar...

Is it possible to get the More Tab Item with a UITabBar?

Is it possible to automatically generate a More button with a UITabBar when there are more than 5 on screen? UITabBarController can do this, but I would like to use the UITabBar. ...

How to add a subview to a UIViewController?

I am trying to add a UITabBarController to a UIViewController: [self.view addSubView:tabBarController.view]; I get a warning: warning: 'UIView' may not respond to '-addSubView:' How can I add a UITabBarController to my UIViewController? ...

How to set view outlet?

I have a UIViewController that contains a UITabBarController which is loading a UITableView from another nib. The TableView view is set to files owner. How can I set the view property in the UIViewController that contains the UITabBarController? ...

UITableView throwing exception

I am getting the following error on a very simple UITableView: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x5d73210' Here is my code: #pragma mark - #pragma mark Table view data source - (NSIntege...

What does "NSBinarySearchingFirstEqual = (1UL << 8)" mean in an enumeration definition?

I saw this in NSArray.h header file in the framework directory: enum { NSBinarySearchingFirstEqual = (1UL << 8), NSBinarySearchingLastEqual = (1UL << 9), NSBinarySearchingInsertionIndex = (1UL << 10), }; typedef NSUInteger NSBinarySearchingOptions; What's the point of "NSBinarySearchingFirstEqual = (1UL << 8)"?And what's t...

use of NSFilemanager

Hello, I am working as an Iphone developer since 5 months but never ever i have used NSfilemanager class. Apple has documentation but still i am not cleared about its use. My question is that can anybody tell me(with example) how and when to use the NSfilemanager class ? Any help will be appreciated. Thanks. ...

Starting Objective-C, memory leak concerns

Hey guys, I'm starting to play around with Objective-C and I want to make sure I get memory/properties right. Suppose the following code: @interface Rectangle : NSObject { Vector2* origin; //[...] } Rectangle* myRect = [[Rectangle alloc] init]; myRect.origin.x = 100.0f; [myRect print]; myRect.origin = [[Vector2 alloc] init];...

Custom setter methods in Core-Data

I need to write a custom setter method for a field (we'll call it foo) in my subclass of NSManagedObject. foo is defined in the data model and Xcode has autogenerated @property and @dynamic fields in the .h and .m files respectively. If I write my setter like this: - (void)setFoo: (NSObject *)inFoo { [super setFoo: inFoo]; [sel...

CGRect var as property value?

CGRect type is a structure type. If I want to define a property as this type, should I use assign or retain attribute for this type? @interface MyClass { CGRect rect; ... } @property (nonatomic, assign) CGRect rect; // or retain? or I have to write my own getter and setter? ...

Are protocols inheritable in Objective-C?

I saw this in some header file in the framework directory: @interface NSCharacterSet : NSObject <NSCopying, NSMutableCopying, NSCoding> @end @interface NSMutableCharacterSet : NSCharacterSet <NSCopying, NSMutableCopying> @end I thought protocols were inheritable.If I am right about that,There is no need to type <NSCopying, NSMutabl...

iPhone OAuth with formspring

I'm trying to authenticate with oauth for the formspring.me website using the oauthconsumer framework. I'm successful getting the request token (see 'getRequestToken'). I show them the authorization URL and have them authenticate. I don't see the callback url ever being requested in the webview (even though I believe I specify it with th...

How to reset keyboard for an entry field?

I am using tag field as a flag for text fields text view fields for auto-jumping to the next field: - (BOOL)findNextEntryFieldAsResponder:(UIControl *)field { BOOL retVal = NO; for (UIView* aView in mEntryFields) { if (aView.tag == (field.tag + 1)) { [aView becomeFirstResponder]; retVal = YES; break; } } ...

iPhone SDK Question with Audio/Mic

I am trying to do an app, to where when it launches, it will detect audio, and then play it back automatically. NO BUTTONS, nothing to press. Just a picture of something then, it listens for audio, then plays it back. Similar to the Talking Carl app in the App Store. Any ideas/help? Would appreciate it, if i could use the code with IB. ...

how to copy array?

I have four arrays as follows: toArray = [[NSMutableArray alloc] initWithObjects:@"to 1",@"to 2",@"to 3",@"to 4",@"to 5",@"to 6",@"to 7",nil]; fromArray = [[NSMutableArray alloc] initWithObjects:@"from 1",@"from 2",@"from 3",@"from 4",@"from 5",@"from 6",@"from 7",nil]; messageArray = [[NSMutableArray alloc] initWithObjects:@"message ...