objective-c

Create a Core Date Entity Instance But not want it to be stored(non-persistent)

Sometimes I need instantiate CoreDateEntity to store some infomations for temporarily using. But I needn't it be stored into DB. currently I created a similar class which have same structures as the CoreDateEntity does. It works well but I have to do many datas transfer between Two models. Is there any better way to handle this? Tha...

How does the objective-c SBJson library map an array? (do you reccomend it?)

SBJsonParser *parser = [[SBJsonParser alloc] init]; NSMutableArray *componenti = [parser objectWithString:@"[\"Item1\",\"Item2\"]"]; NSAssert([componenti isMemberOfClass:[NSMutableArray class]],@"err"); This code gives me an assertion failed. What is wrong? The header file says: @brief The JSON parser c...

String splitting problem

I am work on a simple program in which I split a string and a user global, I use the following code for splitting the string. NSString *GlobleStr;//globale variable //=============== NSString *xmlParsingResult=@"Apple,iphone"; NSArray *array = [xmlParsingResult componentsSeparatedByString:@","]; NSString *StrResult = [NSString stri...

Using Kal calendar without doing the initialization (and so on) in the AppDelegate

I'm using the Kal calendar. For the code shown below I'm referring to the Holiday example. In this example the allocation and initialization of Kal is done in the applicationDidFinishLaunching in the AppDelegate. The UITableViewDelegate protocol (e.g. didSelectRowAtIndexPath) is also positioned in the AppDelegate class. The AppDelegate:...

Understanding Protocol Inheritance in Objective-C

I'll appreciate if anyone can explain the logic behind protocol inheritance. e.g. what does the following mean (UITableView.h): @protocol UITableViewDelegate<NSObject, UIScrollViewDelegate> The following class implementation doesn't work. I have a class View1 (which inherits UIView), with an associated protocol. I have another class,...

Can't access an NSMutableArray created with Json in another object.

I create an NSMutableArray: SBJsonParser *parser = [[SBJsonParser alloc] init]; NSMutableArray *components = [parser objectWithString:@"[\"Item1\",\"Item2\"]"]; then I access it from the same method: no problem! Then I try to access it from another object: crash!!?? It doesn't happen if i create the NSMutableArray with other means (e....

iPhone's "in app" email is queued for later... and sent now too?

After a user tries to send some "in app" email from my iPhone app... I'd like to inform them of what happened. I put some code like this in my "didFinishWithResult" method: if(result == MFMailComposeResultSent ) NSLog(@"Email sent"); if(result == MFMailComposeResultCancelled) NSLog(@"Email cancelled"); if(result == MFMailComposeR...

Reload table/array with function?

Hi I have this code, what am I doing wrong? I have a function which I call playing a number of strings into an array. Then at some point I want to reload it after the user has edited the strings. This is the function: NSMutableArray *lessonsFunc(id a, id b, id c, id d, id e, id f){ monData *mon = [monData sharedData]; return [...

questions to scifihifi-iphone project for using the apple keychain

The scifihifi-iphone project is a wrapper for the Apple Keychain. But it not documented enough. For which iphone OS is this made? iOS 3? What does the "UI" group do? Do I need this? How to use it? Thanks in advance! ...

Animating UIView frame movement in animationDidStop

I have a UIView which i animate the movement of it's frame. However, now, i want to change the alpha value so its fades out as it moves... The alpha needs changing back at the end of the animation. My first thought was to use an animationDidStop Selector but, this View is only in scope where the animation block is... i.e. in the Stop sel...

upload video using FTP

Hello, I have a module which can record a video using iphone camera... and can upload that video using FTP ? I am unable to upload video file using FTP. Any ideas ? ...

NSFetchedResultsController always returns NSManagedObject objects instead of custom

Hi there, I am using CoreData and have an Entity ContactList defined, which I created using the XCode xcdatamodel tool (or whatever you call that built-in thing:). I also set the Entity's Class name to "ContactList". I then used rentzsch's mogenerator (http://github.com/rentzsch/mogenerator) to generate my custom class files and added t...

Should loaded images and text be stored in memory or retrieved each time

My app has various pins that drop onto a map and when you click on the pins you get more information about this entity. Each time you click on the entity it retrieves the information from a web service. Should I only retrieve this information once and store it in memory or should I retrieve it each time that page loads? It's a small a...

When to use self and when to use retain

Hi, am working my way through the "Beginning iPad Development" Apress book and have noticed that sometimes when the author is assigning values to a property they will use: self.variable = value; and other times, they will use: variable = [value retain]; In both cases variable is a property defined as: @property (nonatomic, retain)...

Objective-C retain clarification

I'm looking at this code: NSMutableArray *controllers = [[NSMutableArray alloc] init]; for (unsigned i = 0; i < kNumberOfPages; i++) { [controllers addObject:[NSNull null]]; } self.viewControllers = controllers; [controllers release]; Later on... - (void)dealloc { [viewControllers release]; ... } I see that self.viewCon...

Leaks when adding-removing objects to a MutableArray

Hi guys, i have a memory leak in my app. My app launches on a tableviewcontroller. i parse a json file to fill an array. Then this array is used to fill the tableview's cells. I fill my array with objects (class). I do: [tab_Demandes removeAllObjects]; for (NSDictionary *demandeD in demandes) { Demande *dem =[[Demande alloc] ini...

Why does my iPhone App remember its UI state partially?

I have made a small test app with a button and a UISlider. Touching the button changes its label text. I have added IBOutlet properties for both controls. I'm releasing all properties in viewDidUnload and also set them to nil in dealloc. The interesting thing is now: I touch the button. Its tag is changed from "0" to "1" and, its text i...

Should I use properties or direct reference when access instance variables internally?

Say I have a class like this: @interface MyAwesomeClass : NSObject { @private NSString *thing1; NSString *thing2; } @property (retain) NSString *thing1; @property (retain) NSString *thing2; @end @implementation MyAwesomeClass @synthesize thing1, thing1; @end When accessing thing1 and thing2 internally (i.e, within the impleme...

iphone: tab bar controller: how to call methods ?

Hi guys!, i need some help: i have several views (view xib): login, sign up, settings, and so on. i have created a project, added a tab controller and the tabs are working fine. The problem is that: we have 2 sign up 'ways' and my boss want them in two different tabs. The code is almost equal, so my idea is: instead of hav...

UILabel Setting Transparent Background Color?

I am looking to add a black label with a transparent background to my view (see below) // ADD LABEL UILabel *label = [[UILabel alloc] init]; [label setFrame:CGRectMake(124, 312, 72, 35)]; [label setText:@"Yay!"]; [label setTextAlignment:UITextAlignmentCenter]; [[self view] addSubview:label]; [label release]; When I add the label it al...