objective-c

Objective C- How to add digits in a number?

How do I add the digits in a particular number for example if the number is 3234 the result should be 3+2+3+4 = 12? ...

How can I map the iphone's compass values to the screen coordinates?

Hi everyone, I'm doing an AR app that shows a UILabel in the cameraView depending of the position of a concrete place. When the compass of the iphone is leading to the place, the label is shown in the center of the screen. My problem is that I want this label rotates to the left or the right when I turn the iphone. I guess there is some ...

Use NSMutableURLRequest with JSP

Hello, I'm trying to send an HttpRequest from an iPhone app with some parameters. The form is like this: foo.jsp <form action="/foo" method="post"> <div> <input type="hidden" name="id" value="1" /> <input type="hidden" name="vendidas" value="25" /> </div> <div><input type="submit" value="Send!" /></div> </form> So in the iPho...

Failed to swap renderbuffer in iphone app

Hi all Im having a problem with an iphone app that im working on.im using objective c and cocos2d. The frame rate just drops drastically. I have tested for leaks and allocations etc using instruments and all looks good on that front. I am not using any particles or sound at the moment so its not anything like that. its just animated spri...

Xpath query not working in Objective C using GdataXML

Hi, I am trying to parse an xml using GdataXML I have a query which is not working and I wonder why: <address_component> <long_name>Mars</long_name> <short_name>Mars</short_name> <type>route</type> </address_component> I want to save the long_name where the type is route and I am using this query /*[name() = 'address_compo...

Rotating/moving objects on a UIView

I need to rotate and move objects on a UIView when the orientation changes. To that end I have the following in willRotateToInterfaceOrientation if (UIInterfaceOrientationIsLandscape(toInterfaceOrientation)) { [self repositionObjectAfterRotation:scrollView x:0 y:100 width:480 height:150]; [self repositionObjectAfterRotation:page...

UIModalTransitionStylePartialCurl with mkmapview

HI I am bit new to the IPAD app developement. we have a requirement in our project, to display the google map exactly look like the goolge map application in IPAD. Could any one give me an example if you come across..? i have been searching for this from yesterday. could not fine any. PLease give me any links or ideas which has an e...

IPhone remember where you've been

Hi, Is there any way an iPhone app can remember the path it took to get to a particular page. For instance Home -> Subcategories page with parameter Category = Electronics -> List of products with parameter Category = MP4 players -> Product page with parameters productId = 398483 and productName = iPod Touch 8GB so that if I go back f...

Cocoa Programming Help! NSString and NSTextfield stuff!

Hi experts, thanks for going through my question. But I have something like this... I have an application that has a NSTextfield named userName, a NSTextfield named helloName, and a NSButton that starts the whole process. All it does is that the user types in his/her name in the Name textfield. when the user presses confirm, the Hello...

locationServicesEnabled always return YES

I tested my device (iPod Touch 2G iOS 4.1) if location services are enabled permitted = [locationManager locationServicesEnabled]; and I always get a YES whether location services are enabled or not. I'm talking about the general button for location services and not the app specific button. On iPad with iOS 3.2.2 everything is working...

Adding an extra cell to the top of a UITableView in Cocoa

I have a table being generated from an array of NSManagedObjects. This works fine until I try to add an extra cell at the top of the table. Here is what I'm trying at the moment: -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { int menuLength = [mainMenu count] + 1; return menuLength; } ...

What does NSApp hide: actually do with the NSWindow instances?

Hi, I'm working on an NSWindow subclass and I'm running into some strange behavior that makes me question some of my assumptions about how windows work on Mac OS X. What precisely happens to NSWindow instances when [[NSApplication sharedApplication] hide: self] is called? All windows that do not return NO to -(BOOL)canHide disappear f...

NSMutableArray how to properly addObjects and release

Hi all! I am worried about than am I properly adding object and releasing them. What NSMutableArray actually contain - object's copy or just a pointer to them? What is the sequence in working with NSMutableArray? (alloc, init, work, release) How to retain and release it properly? NSMutableArray *listData = [[NSMutableArray alloc] init...

Click Thumbnail to Expand Image in UITableView

Hey guys, So I have a UITableView that has a list of image names and corresponding thumbnails, and I'd like to implement some sort of click to expand thumbnails, so when a user clicks on the thumbnail, it expands to fill the whole screen. Is there an easy way to do this? It needs to only expand for the image part of the cell, not the te...

Custom content redraw on UIScrollView zoom/unzoom?

I have a parent UIScrollView and inside it, there are several UITableViews. Horizontal scrolling should be handled by parent, vertical scrolling and taps - by children. As far as I know, that's feasible, I've seen some sample from Apple. By I also want to intercept pinch-to-zoom events and do a total redraw of parent scrollView's content...

UITableViewCell gradient layer auto resize

I'm using the CAGradientLayer method from this answer to set a gradient on my UITableViewCells. However, for this table, I increased the height of the cells via tableView:heightForRowAtIndexPath:. My gradient layer now does not cover the full height of cell, but instead stops at the original height (see pic). I tried setting the fra...

Format array items for string output.

I'm trying to display the items in an array using the following: NSString *alertString = [NSString stringWithFormat:@"%@", path]; Which works fine, but when I display the string it gets displayed in the following way: ( A, B, C, D ) Is there a way to get it to display in a different way, such as all on one line and without brackets,...

iOS Singleton Variables Not Keeping Their Values

So I'm still kind of new to Objective-C, and this was my first app that I'm now updating. The idea is this: The whole app is basically various lists of stuff. It asks the API for 15 posts, shows those with a Load More button. Click Load More, it loads 15 more, etc. The API that it loads these from has a token system with a timeout built ...

Error with UITableViewCell

I am getting an error of: * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull isEqualToString:]: unrecognized selector sent to instance 0x26e9d68' I have a FriendViewCell class which has a UIImageView and two other labels as an IBOutlet. Setting the property and synthesize it (basic stuffs). I ha...

UIScrollView does not resize correctly

I have code to rotate and size a scrollview, such that when the iPhone is landscape the orientation is correct. This is what the view looks like before rotating: The scroll view is in yellow. This is what it looks like after: This is the log statement i put after setting the new frame for the scroll view, and you can see that it i...