objective-c

What is the Monotouch equivalent of dealloc?

I am looking at an example online that contains this code in objective-c -(void)dealloc { [activeController viewWillDisappear:NO]; [activeController.view removeFromSuperview]; [activeController viewDidDisappear:NO]; [activeController release]; [super dealloc]; } I assume the MT equivalent would be Dispose, am...

Getting an NSString out of an NSArray

I am trying to save and read back some application settings stored as NSStrings in an iPhone app and have been having some trouble. The code to save looks like: NSMutableArray *array = [[NSMutableArray alloc] init]; [array addObject:accountID]; ... [array writeToFile:[self dataFilePath] atomically:YES]; [array release]...

Compare two nsdatecomponent

Hi all, if I have two nsdatecomponent and I want a know if the TIME in the first object is bigger than the second. example: if (nsdatecomponentObject1 > nsdatecomponentObject2) { //something } Because this way don't works, how I can do this? Alex ...

Debugging a library with Xcode

Hi there, I have a more general question on working with libraries on with Xcode when building iPhone apps. I've created a framework from a project I've been working on to use some parts of it in other apps. That works pretty good, so far. But I have no idea how to debug into the files included in the included framework. I hope to get ...

Is there a way to turn this JavaScript code into Objective-C?

http://static.reclaimprivacy.org/javascripts/privacyscanner.js Or at least to understand the code as it is very difficult to read? ...

Limit a double to two decimal places without trailing zeros

I read this and that. I want this exactly: 1.4324 => "1.43" 9.4000 => "9.4" 43.000 => "43" 9.4 => "9.40" (wrong) 43.000 => "43.00" (wrong) In both questions the answers points to NSNumberFormatter. So it should be easy to achieve, but not for me. - (void)viewDidLoad { [super viewDidLoad]; UILabel *myLabel = [[UI...

Cross View Communication

I have a UIWebView on my main window. Can I control that via my second view controller? If so could you give me an example? ...

Objective-C 'RootViewController' may not respond to '-parseXMLFileAtURL:' error in xCode

I have this error when building and running my project in xCode: 'RootViewController' may not respond to '-parseXMLFileAtURL:' I'm attempting to develop the basic Apple RSS Reader from the tutorial at: http://gigaom.com/apple/tutorial-build-a-simple-rss-reader-for-iphone/ my section of code that this error is occurring in looks like t...

Typedef enum setting and accessing

Hello there! I have this before the interface declaration in my MainView.h header. typedef enum { UNKNOWN, CLEAR, NIGHT_CLEAR, CLOUDY, NIGHT_CLOUDY } Weather; Then I declared it like this: Weather weather; Then made an accessor: @property Weather weather; And synthesized it. My question is, how can I use this in a different...

Objective C - NSDateFormatter returns nil ??

NSDateFormatter* dateFormatter = [[[NSDateFormatter alloc] init] autorelease]; [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss.sss"]; self.date = [dateFormatter dateFromString:dateString]; the code works fine with this string "2007-06-10 06:31:54.935" but doesn't work with this one (it returns nil if the time is set to 0): "20...

Image processing resources on Mac with objective-c

Can anyone suggest good image processing tutorials/books to start, on Mac using objective-c? ...

iPhone - Conflicts with multiple UIGestureRecognizers

I'm currently having some conflicts with UIGestureRecognizers that is causing everything to place nice with each other. I have several squares (UIView) on the screen that let the user to pan and pinch (used to scale the views). I have a UIPinchGestureRecognizer added to the main view which the squares are added so that I can scale the ...

UITableView with multiple datasource

Hi, I have a ViewController that needs to use 2 UITableViews. 1 is always showing, while the other will show up as a popup after you click on a button on the view. Typically I set the delegate and datasource to the File's Owner. However, since 1 of the UITableViews is in a popup, I'm not sure how to best tackle this. e.g how do I tack...

Memory Management: Is insertSubview retaining it's views?

The question is if insertSubview is retaining the views and if I'm doing it right. I would say yes. Since I'm not using the property anymore I don't receive an EXC_BAD_ACCESS. I think when releasing the view all subviews are also released. And so mapView is over-released. I'm right or do I still have a memory management issue? My ViewC...

how to properly debug in xCode and Objective-C

Hi, I was wondering if there is an effective way to debug problems in xcode while coding in Objective-C. I create webpages constantly and code in jquery and javascript where you can set various alert boxes in different places in your code to determine if your script is properly executing sections. Can you do something like that in xcod...

Reusing methods in multiple classes...

I've just implemented iAds in an app with several distinct UIViewControllers. I have the delegate methods in each one for - (void)bannerViewDidLoadAd:(ADBannerView *)banner and - (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error that show and hide the banner, along with a setup method that creates a ba...

What is wrong with this string format (different behavior on simulator and device)?

I have this block of code executed when pressing a number: NSString *currentValue = [@"" stringByAppendingFormat:@"%.02f", [[[[[textField text] stringByReplacingOccurrencesOfString:@"." withString:@""] stringByReplacingOccurrencesOfString:@"," withString:@""] stringByReplacingOccurrencesOfString:@" " withString:@""] doubleValue]/100...

Back button not working for view transition

I am trying to add a back button to the sample viewtransition app. My issue is that when I tap the back button I added to the navigation bar it goes nowhere fast. Link to sample code below. http://developer.apple.com/library/ios/#samplecode/ViewTransitions/Listings/Classes_ViewTransitionsAppDelegate_m.html#//apple_ref/doc/uid/DTS400074...

objective-c create a UIlabel with a hyperlink

hi all! what's the best way to create a label to link a web page? thanks in advance! Paolo ...

Core Data errors in iPhone app. "_OBJC_CLASS_$_NSFetchedResultsController"

"_OBJC_CLASS_$_NSFetchedResultsController", referenced from: objc-class-ref-to-NSFetchedResultsController in RootViewController.o I'm getting 7 of the errors above in my iphone app. I had an app that used core data but i wanted to use an rss xml parser with it, so i created a new empty app and put both of the projects into it, now i hav...