objective-c

Determining the number of objects in an NSArray

Hi friends, I am making a book application. To move to the next topic I am using a button. The Button works as it moves to the next topic, but at the end of the file my application gets the message obj_fatal and it crashes. If I knew how many objects there are in my NSArray then the problem will be solved. I am getting the details from ...

How to access camera in my application

Hi I am new in iphone. I want developing a application that we can capture image from iphone camera. How to do this i am not understand. Plz help me how to do this with source code and link where we can read this. ...

NSArrayController binding : Suppress "No selection"

Hello, I have a texfield bound to an ArrayController. The controller key is "selection" because I select items from a NSTableView. But when there are no items in the table the textfield shows the gray text "no selection". How can I suppress this text and have just an empty textfield? Or how can I change the "No selection" text to somet...

How do you convert an int to a byte in Objective-C?

Hello, I have an int value which needs to be converted into a byte array. How do you go about doing this in Objective-C? Are there methods to do this? Thank you, ...

Problem in getting the current location using reverse geocoder.

Hi guys, Here Im getting problem I need to Get the full address of current location as: 99 Infinite loop, Cupertino, CA 95014, USA. As I am new to this topic I dont know how to get the full address using reverse geocoder. I written My code as: -(void)gettingCurrentLocation { CorkItAppDelegate* appDelegate = (CorkItAppDelegate*...

initWithCoder and initWithNibName

I am trying to encode some data state in a UITableViewController. In the first time, I init the object with Nibname without any problem. However, when I initWithCoder, the UITableViewController still loads but when I clicked on a cell, the application crash and the debugger tells me about EXEC_BAD_ACCESS, something wrong with my memory, ...

UIWebView comparing current and defined URL's with a loop depending on result

I am trying to compare the current url in webView with a defined url say google.com so in theory.. NSURLRequest *currentRequest = [webView request]; NSURL *currentURL = [currentRequest URL]; would give us our current url... NSString *newurl = @"http://www.google.com"; this would give us the compared to defined url while (!cu...

How could I pass the float number by value in obj-c?

- (void)applicationDidFinishLaunching:(UIApplication *)application{ // Override point for customization after application launch [window makeKeyAndVisible]; [self printFloat:1.3f]; } - (void)printFloat:(float)f { NSLog(@"%f",f); } I passed the "1.3f" to printFloat, but it was the wrong value (in this case, -2.000000) after "f...

Forcing UIInterfaceOrientation changes on iPhone

I'm strugging with getting an iPhone application which requires just about every push or pop in the Nav Controller Stack to change orientation. Basically the first view is portrait, the second landscape the third portrait again (Yes I know this is less than ideal, but that's the design and I've got to implement it). I've been through v...

How to judge the color of UILabel?

UILabel *templabel = [self.wallBoxArray objectAtIndex:i]; for( int i = 0 ; i < [self.wallBoxArray count]; i++) { if(templabel.backgroundColor == [UIColor greenColor]) { NSLog(@"the color isn green"); } } There are many label's in my array. They all initialized with green color. But i judged that way ,why cant print " th...

How can I access class variable inside a NSMutableArray object?

I have "Man" class which also has 2 variable : "description" and "name". At a point, I created Man class and initialize with its own variables (description and name) and pass it to NSMutableArray "collector". How can I access description now ? I tried but ı could not get the property ...

How to assign a value to an pointer-pointer passed in call by reference?

I want to achieve something similar to what these guys do here: - (NSUInteger)countForFetchRequest:(NSFetchRequest *)request error:(NSError **)error like you can see, you pass an NSError pointer and that nice method will assign a real NSError object to your pointer in case there is an error. So the cool thing about this is, that the m...

How to pass and set a CGFloat by reference?

I want to make an method which takes an CGFloat by reference. Could I do something like this? - (void)doStuff:(CGFloat*)floatPointer I guess this must look different than other object pointers which have two of those stars. Also I'm not sure if I must do something like: - (void)doStuff:(const CGFloat*)floatPointer And of course, n...

Get just the scaling transformation out of CGAffineTransform

I found a similar question about getting just the rotation, but as I understand scaling and rotating work different in the transform matrix. Matrixes are not my strength, so if anybody would hint me how to get only the scaling out of a CGAffineTransform I'd greatly appreciate. btw. I tried applying the CGAffineTransform on a CGSize and...

how to get header files from CoreTelephony.framework for telephone control api

Hi, I want to develop an iphone re-dialer application, for that coretelephony.framework is needed as it contains required telephone control api. But i'm unable to class-dump headers of coretelephony.framework as it is C headers. Can anybody help me to dump headers of coretelephony framework? Thanks in Advance. ...

NSMutableArray of Objects misbehaves ...

I hope someone understands what happens to my NSMutableArray. I read records a, b, c, d from a database, load the fields into an object an add the object to an array. To do this I read the records into an instance of that object (tmpEvent) and add the Object to the target array (NSMutableArray myArray). the code looks like: for (condi...

Can I restrict the NSMutableArray object type?

I want the NSMutableArray only store "MyObject" only... ...instead of any objects. How can I do this? thz. ...

Replicate UISegmentedControl with UIButtons - iPhone

Hi guys, I didnt like the style of UISegmentedControl, hence i tried to change the way it looked, but I couldnt attach images to its buttons. I just didnt change at all. Now i'm looking at how to replicate that function with 4 UIButtons. I've setup 4 UIButtons in interface builder, added different tag numbers to them. What i cannot a...

How to use a C array as instance variable?

For example I want to store this in an ivar: CGFloat color[4] = {red, green, blue, 1.0f}; so would I put this in my header? CGFloat color[]; How would I assign values to that guy later? I mean I can't change it, right? ...

Objective-C memory management issue

I've created a graphing application that calls a web service. The user can zoom & move around the graph, and the program occasionally makes a decision to call the web service for more data accordingly. This is achieved by the following process: The graph has a render loop which constantly renders the graph, and some decision logic which...