objective-c

How can I change 'self.view' within a button method created outside of 'loadView'

Hey guys. So I am creating buttons dynamically within loadView. Each of these buttons is given an action using the @Selector method, such as : [button addTarget:self action:@selector(showCCView) forControlEvents:UIControlEventTouchUpInside]; Now that showCCView method is defined outside of loadView, where this above statement is locate...

How to pass a value from one view to another? (iPhone)

for example, I have a textfield, that records the user name, after I click the button, it will display the next view, and I want the next view ge the text field data, and display on the second view, how can I do so? ...

Objective-c - Passing in variables to a variable-length method

I've got an array with items, and I want to pass these in to a variable-length method. How do you do that? I.e., I've got this (for example): NSArray *array = [NSArray arrayWithObjects:@"1", @"2", @"3", nil]; [[UIAlertView alloc] initWithTitle:@"title" message:@"message" delegate:nil cancelButtonTitle:[array objectAtIndex:0] otherButt...

Simple Objective C Question: How can I get access to a variable from other class?

It is my MyName.h: #import <Foundation/Foundation.h> @interface MyName : NSObject { NSString *myName; } @property(readwrite) NSString *myName; @end and this is the .m: #import "MyName.h" @implementation MyName @synthesize myName; @end It is my another controller.m #import "MyName.h" #import "MainViewController.h" @i...

Object Messaging Terminology?

I am just curious, I am writing some notes for a friend and am not sure how to best refer to whats happening here ... [myObject display]; access the object by calling display access the object by messaging display access the object by sending the display message other ... Just want to make sure I get the terminology right. gary ...

Applied delegating and protocols

Hello, I am trying to figure out the reason why I should learn these things about delegates and protocols. First I thought that it was necessary in order to create nice(er) design of the code. Then I started to read and I cannot really find the reasons I though that I was going to find (That is, "good" reasons...). When should I apply ...

UITabBar leaves a white rectangle when hidden

I have been unable to google an acceptable solution to this that can be applied to my project. My app is a graphing tool that has three tabs; one for the graph itself and the other two are for browse/search functions for things that can be added to the graph. All tabs are navigation controllers. The tab for the graph itself, when in po...

Xcode Objective-c warnings "creating selector for nonexistent method" with OCUnit (SenTestingKit)

I started getting getting warnings like the following in XCode when trying to write some unit tests with OCUnit (SenTestingKit). warning: creating selector for nonexistent method 'myMethodName1:' warning: creating selector for nonexistent method 'myMethodName2:' ... warning: creating selector for nonexistent method 'release' warning: c...

Change an NSSet of NSNumber into an NSSet of int

Hi everyone, I'm using the data with core data and get an NSSet of NSNumber... my question is how can I do to change easily all the objects into int values? or can I directly get the int values from the database? Thanks ...

How to upload image to remote server in iphone?

Hi Everybody, I am trying to upload a image which i am clicking with the help of the camera. I am trying the following code to upload the image to the remote server. -(void)searchAction:(UIImage*)theImage { UIDevice *dev = [UIDevice currentDevice]; NSString *uniqueId = dev.uniqueIdentifier; NSData * imageData = UIImagePNGRepresentati...

Basic questions re Objective-C property syntax

I have a few basic questions regarding the syntax and usage of properties in Objective C and would appreciate it if someone could answer them please. Assume the following declaration in the header: @interface TestObject : NSObject { NSArray *myArray; } @property (nonatomic, retain) NSArray *myArray; In the implementation, can ...

NSURL parameterString with .NET service call.

I'm tring to use the NSURL class's parameterString message to return the string from the following url: http://www.host.com/Api/Service.svc/GetStuff?param=thisIsTheParamValue I keep getting nil for the parameterString. Does that url not conform to the standards that Apple uses? ...

Sorting NSSets of a core data entity - Objective-c

Hi everyone, I would like to sort the data of a core data NSSet (I know we can do it only with arrays but let me explain...). I have an entity user who has a relationship to-many with the entity recipe. A recipe has the attributes name and id. I would like to get the data such that: NSArray *id = [[user.recipes valueForKey:@"identity"] ...

Pointer to NSWindow Xib after loading it?

In my code below, CustomWindow is a subclass of NSWindow. CustomWindow *window = [[CustomWindow alloc] init]; if (![NSBundle loadNibNamed:@"NibName" owner:window]) [window center]; // doesn't work How do you get a pointer to control your XIB after you load it so you can do things such as centering the NSWindow (I mean the serialised o...

compare a NSNumber with a fixed value?

Is there a better way to compare a NSNumber with a fixed value, it just feels a little clunky. if([myNumber isEqualToNumber:[NSNumber numberWithInt:0]]) NSLog(@"Zero"); I do know I can use -compare but it pretty much looks the same ... gary ...

Optimal pixel format for drawing on iPhone?

Pretty simple question: when doing some pretty intense drawing with CoreGraphics on the iPhone, how can I specify the pixel format to get optimal performance? Is the format that I get from the context via UIGraphicsGetCurrentContext per definition the best one? I know that RGB565 is supposed to be the fastest to use in OpenGL. Does that ...

How to emulate bottom alignment in a UITextField

I would like to have a UITextField which aligns to the bottom and to the right. I would like the majority of text to be on the bottom line with putting extra words on the next line as needed. I have been messing around with different layoutSubviews implementations to achieve this functionality. However, the text always fills the top l...

What do I need to know to manage memory in Objective C++?

I'm working with a C++ audio library in an iPhone app. Is there any Objective C / Cocoa memory management infrastructure I can use for my C++ objects, or do I need to just read up and learn C++ memory management? ...

Trying out Push Notification Example on Advanced Iphone Projects "Apress"

hello all im trying out the chapter 10 example on push notifications. dont know if anyone has read it, its a really great article on push notifications. the code seems fine, the only problem i have is when i use NSString *registerResult = [NSString stringWithContentsOfURL:[NSURL URLWithString:getURLString]]; it give me a warning that i...

My UITabBarController isn't appearing, but its first view is?

I've done some reorganizing of my project recently and now I'm not seeing my tab bar controller, but its first view controller's view is appearing. Here's a breakdown of everything that happens prior to the problem. App Delegate loads FirstViewController with nib. FirstViewController loads the application data from my server and then ...