objective-c

using appDelegate to share data - getting "request for member in __ not in structure or union"

I've got a simple example where i have a delegate that has a string, along with a property to expose it. myAppDelegate.h #import <UIKit/UIKit.h> @interface myAppDelegate : NSObject <UIApplicationDelegate> { UIWindow *window; UITabBarController *rootController; NSString* myText; } @property (nonatomic, retain) IBOutlet UIWi...

Passing value to method is always zero.

i have a method in subclass of UIView like this -(void) reDrawPreviewWith:(UIColor *)textColor withGlowColor:(UIColor *)glowColor withGlowIntensity:(float)glowIntensity I am calling this method by float glowIntensity = 30.0f; [preview reDrawPreviewWith:[UIColor colorWithRed:red green:green blue:blue alpha:1.0] ...

(retain, nonatomic) and (nonatomic, retain) any difference?

What is the difference between (retain, nonatomic) and (nonatomic, retain) in code such as this: @property (retain, nonatomic) YellowViewController *yellowViewController; ? ...

When would a instance variable be used and when would a property be used?

In a header file such as this, when would an instance variable be used and when would a property be used? Do they have to have the same name? #import <UIKit/UIKit.h> @class BlueViewController; @class YellowViewController; @interface SwitchViewController : UIViewController { YellowViewController *yellowViewController; BlueView...

EXC_BAD_ACCESS in an NSArray created 3 lines before crash

Hi there, I'm just starting out on my first 'real' cocoa app. Note that this is Mac, not iPhone. This function is called when my async download of onemanga finishes, and is intended to parse an NSArray list of manga from it. I get a NSArray from nodesForXPath, and retain it to make sure it's mine. (Also tried retaining it twice, heh). ...

not able to open a url with openURL in [UIApplication sharedApplication] ??

i am trying to open a url (http://c22.smaato.net/oapi/lp.jsp;jsessionid=E253E547A55290CA553F493659433DBF.c22) on a button through the following code NSString *strs=[[NSString alloc]initWithFormat:@"%@",[linkArry objectAtIndex:0]]; NSURL *urls = [NSURL URLWithString:strs]; [[UIApplication sharedApplication] openURL:urls];...

Reading binary file into array in Objective-C [iPhone]

Hey I want to read binary file on my iPhone. I have .txt file which stores information about an array: int[6000][9] How can I put this data into an array in my code? I tried this: int mapa1[6000][9]; NSFileHandle* file = [NSFileHandle fileHAndleForReadingAtPAth: @"level1.txt"]; [[file readDataOfLength:4] getBytes:mapa1]; mapa1 = NSSw...

Elegantly add object to arraycontroller, which itself is linked to another arraycontroller?

Hello everyone I'm new to Mac programming but generally liking it. I have the following problem: I have two core data entities linked through a one-to-many with their respective arraycontrollers (Stock Controller and Price History Controller, where the latter controller is bound to the Stock Controller, with Controller Key = selection ...

Fluent interface pattern in Objective-C

I am a newbie in Objective-c and I would like to implement fluent interface pattern in my OC class. Here is my updated and simplified case from my project: // .h file @interface MyLogger : NSObject { ... } - (MyLogger*) indent:(BOOL)indent; - (MyLogger*) debug:(NSString*)message, ...; - (id) warning:(NSString*)message, ...; .... @end...

Possible to add another enum item to an existing enum type

Hi all! I wonder, whether it is possible to add/append another item to an existing enum type (part of a framework)? Something like this: We have the enum type typedef enum { UIModalTransitionStyleCoverVertical = 0, UIModalTransitionStyleFlipHorizontal, UIModalTransitionStyleCrossDissolve, UIModalTransitionStylePa...

Core Data client+server/background saving/general import question

I'm working on a Core Data-based application that has a Mac application acting as a 'server' and an iPhone as a client. Everything is going swimmingly, except I'm running into performance issues. When the user taps an object, the server must return some objects related to that object (nothing too heavy, usually 3-4 objects) and show a U...

class 'Parser' does not implement the 'NSXMLParserDelegate' protocol

I just downloaded the code from http://cocoadevblog.com/iphone-tutorial-creating-a-rss-feed-reader to see how to implement rss feeder And it shows a warning " class 'Parser' does not implement the 'NSXMLParserDelegate' protocol " at [rssParser setDelegate:self]; in parer.m. App loads in simulator but does not work. I checked in refernces...

How to have a UIView appear from the middle of the screen

I looked at Apple's UIModalTransitionStyle, but didn't see what I was looking for. I want to do the same thing that the Facebook iPhone App does; when you touch on a button on the Facebook's homescreen, the new UIView appears (and then disappears when you are done) from the middle of the screen. I would like to implement similar transi...

A framework header cannot find its own header files in Xcode?

Hi In Xcode, suppose that there is a framework named Foo. Inside the Foo.framework/Headers folder there are files File1.h and File2.h. The header file File1.h includes File2.h via the following directive: #include <File2.h> The Foo framework is a re-package of a C++ library not specifically targeted for the Mac. Now suppose I have...

Cocoa bindings between NSTableView and NSMutableArray refuse to update

Ok, I'm very new to Obj-C and Cocoa, but I'm sure my bindings here are correct. I've been googling, searching stack overflow and have checked my values again and again. So, here are my bindings: They connect to this class: @interface TMMaddMangaWindowDelegate : NSWindowController { ... } ... @property (copy) NSMutableArray* mangaLi...

Pass-by-value argument in message expression is undefined

Hello. I'm developing an iPhone application and I getting that warning at method: NSNumber *latitudeValue; NSNumber *longitudeValue; [self obtainLatitude:latitudeValue longitude:longitudeValue]; The method is declared as follows: - (void) obtainLatitude:(NSNumber *)latitudeValue longitude:(NSNumber *)longitudeValue { NSNumberF...

renderInContext called on MPMoviePlayerController

I am trying to programatically create an image from the current frame of a MPMoviePlayerController video. I am using renderInContext called upon the player's view.layer however the image that is created is all black with the video player controls, but I am expecting to see the current frame of the video My code (http://pastie.org/10200...

NSScrollView doesn't show scrollbars even although the content is large enough

I have this class: Header: @interface vcMain : NSWindowController { IBOutlet NSView *scroll; } @property (retain) IBOutlet NSView *scroll; -(IBAction)test:(id)sender; @end Source: @implementation vcMain @synthesize scroll; -(IBAction)test:(id)sender { vItem *item = [[vItem alloc] initWithNibName:@"vItem" bundle:nil]; ...

Objective-c: How can I get Class instance in class method.

I have 2 classes, Parent and Child, and Parent has a class method named func. Now I want to get Class instance in func method to distinguish which class is caller. @interface Parent : NSObject + (void)func; @end @implementation Parent + (void)func { Class *class = howToGetClass(); NSLog(@"%@ call func", class); } @end @inter...

Optimizing memory usage via appropriate data types

All, I've been a Java developer for 10 years...when it comes to managing numerical data, for the most part I've stuck with int and used double when I need some decimal precision. The reason is we pretty much have a large heap space to work with and exhausting it is pretty difficult for the most part... I'm starting iPhone development ...