objective-c

Invalid initializer, CGPoint

i have this code and on the second line it gives me an error that says invalid initialzer this is the code: -(void)setPlayerPosition:(CGPoint)position { CGPoint tileCoord = [self tileCoordForPosition:position]; int tileGid = [_meta tileGIDAt:tileCoord]; if (tileGid) { NSDictionary *properties = [_tileMap propertiesForGID:tileGid]; ...

Facebook iPhone api, feeds

Hello guys! Is there a way to remove the "userMessagePrompt" ? I paste my code to publish a feed: FBStreamDialog* dialog = [[[FBStreamDialog alloc] init] autorelease]; dialog.delegate = self; dialog.userMessagePrompt = @""; dialog.attachment = [NSString stringWithFormat:@"{\"name\":\"%@ AppName!\"," "\"href\":\"lin...

How can i use circular Progress indicator in my cocoa programming?

this is my code and i want use this object to show loading progress,what should i do? // view.h #import <Cocoa/Cocoa.h> #import<WebKit/WebKit.h> @interface view : NSObject { IBOutlet WebView* webview; } -(IBAction) google:(id) sender; @end //view.m #import "view.h" @implementation view -(IBAction) google:(id) sender {...

Add cocos2d scene to UIViewController..

Hi, I use the following code to add cocos2d scene to a viewcontroller - (void)viewDidLoad { self.view = [[UIView alloc] initWithFrame:CGRectMake(0,0,320,480)]; if( ! [CCDirector setDirectorType:CCDirectorTypeDisplayLink] ) [CCDirector setDirectorType:CCDirectorTypeDefault]; [[CCDirector sharedDirector] setPixelFor...

NSKeyedArchiver archiveRootObject for an object inside an object doesn't work!

I have a Level class, witch contains another Class LevelPoints for some attributes, how can I archive the instance of Level by using [projectDictionary setObject:level forKey:@"testlevel"]; [NSKeyedArchiver archiveRootObject:projectDictionary toFile:@"somewhere"]; I can not get the _levelPoints variable with values out of the [NSKeye...

How to get ISOCurrencyCode from a ISOCountryCode in iphone sdk?

I have the ISOCountryCode avaliable and now i want to derive the currencyCode of this country from the ISOCountryCode. How can i achieve that? NSString *countryCode = < get from someother view>; NSString *currencyCode = ?; I receive this country code from some other view on runtime? ...

Memory leaks in NSMutableDictionary

My coding contains a memory leak, and somehow I can't find the leak. Leaks points me in the direction of the way I create "ReportDetailItems" e.g. areaContainer = [[[ReportDetailItem alloc] init] autorelease]; I've been looking at this for hours and I am at a total loss, the objects reported leaking are "ReportDetailItem", and the NSM...

The relationship between UIViewController and UIView

I'm trying to understand how these two are connected. Every time you make a UIViewController does it also automatically come with its own UIView? Also are these from Cocoa or Objective-C? ...

NSString memory leak ?

Hi there, I'm turning around and around with the following code giving me a memroy leak in the pics object apparently linke to the object imageName. for (int i = 0;i<[potatoesIndexesArray count];i++){ int imageNumber = [[potatoesIndexesArray objectAtIndex:i]intValue]; NSString *imageName = [[NSString alloc] initWithFormat:@"...

Is there a book for Objective-C like "Effective C++" for C++?

In C++ community, "Effective C++" is very famous for its concise, in-depth and practical style. For Objective-C, most of the books in the market is primer introduction to the language. Is there a book for Objective-C like "Effective C++" for C++? BTW, I found this document is very valuable for a programmer from C++ to Objective-C: http:...

"Best" way to structure long views on iPhone

Hi all, I'm working on an iPhone app that (among other things) has a detail view for records with lots of attributes and lots of related records. Rather than having one really long scroll view or table view, I am thinking it might be easiest to break the detail view into several separate views (some UIViews, some UITableViews, etc) tha...

How to recreate a UIViewController stack when the root view controller is a UITabBarController?

Hello, guys. I have an app that if it is quit in a certain view, I want to restore this view exactly where the user left. My applicationDidFinishLaunching is very simple at the moment: - (void)applicationDidFinishLaunching:(UIApplication *)application { // Override point for customization after app launch [window addSubvi...

What to do with my data after connectionDidFinishLoading from NSURLRequest

I'm writing a class that uses a JSON API for a website I visit. In my class I use NSURLRequest to fetch the data, but then I need to give the data to the app delegate. I realize NSURLRequest is asynchronous so I can't directly return the data. So let's say in my class, the delegate calls getUserProfile, the method uses NSURLRequest to g...

Use dictionary with didSelectRowAtIndexPath

I am trying to get the trail name from the selected cell and pass it on to the next view in didSelectRowAtIndexPath. How would I go about this? http://pastebin.com/bgXNfjie ...

UITableView Random White line in section footer when returning properly sized footer

I have a UITableView inside of a View created from a NIB. the table has one section containing 6 rows and 1 footer. when i use: - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ return 80; } to return the height of the footer, which is being loaded from the same NIB. the UITableViewCell ...

Updating NSDocument status without undo?

I have a document-based application but I am not using undo. How do I change the status of my window to be 'dirty' and certain times? Thanks. ...

Setting Exchange 2003 OOF state and reply using WebDAV / objective-c

Trying to set my out of office on with a new reply message on Exchange 2003.... Here's my code: NSString *tempbaseurl = @"https://webmail.server.com/exchange/mailbox/"; NSURL *url = [NSURL URLWithString:tempbaseurl]; NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:url]; NSString *sMessage = @"I am currently out of the...

NSArray in if statement strange behaviour

i have the following two pieces of code which i think should be identical int temp = [[[myArray objectAtIndex:iIndex] objectAtIndex:jIndex] state]; if (temp > 0) { NSLog(@"TEST: %d",temp); } if ([[[myArray objectAtIndex:iIndex] objectAtIndex:jIndex] state] > 0) { NSLog(@"TEST: %d",temp); } state is just an int in the objects ...

navcontroller refresh webview

I have two views controlled by a uinavigationcontroller. the first view has a UIWebView and has button that takes the user to the second view. The user can get back to the first view by tapping the back button on the nav bar. however the webview's content is not current. How can I refresh the content in the first view's webview when comi...

Printf/scanf replacement methods: some feedback/advice needed.

I've recently been writing some basic command-line programs (I want to keep my skills sharp over the summer), but printf and scanf have been starting to annoy me. I'm not a wonderful C programmer, and having to get into printf/scanf and their instabilities (or even worse, fgets and their ilk) isn't exactly putting me in a comforting sett...