objective-c

Can you use KVO with Scripting Bridge

Can you use KVO with Scripting Bridge? I want to know if I can make an Scripting Bridge interface for my application and allow client applications to be notified by observing an object returned by one of my app's SB commands. Is this possible? If not, what's an alternative? ...

NSMutableDictionary not taking key/value pair

Hi all, so here I am stuck at the simplest part (or so I thought) of my small project for this morning. The goal was to build a simple XML Parser who takes every element they encounter and add it to a dictionary that will eventually hold all key/value pairs of the xml. So an xml like this <xml> <1stTag>text</1stTag> <2ndTag>some m...

Grasping the concept of UIviews and UIViewcontrollers

A couple of weeks ago i have started my research in Iphone app development and after alot of hello world applications in different settings i am now ready for my very first application based on the MVC design pattern used in Cocoa. This opens up alot of questions for me though and after reading the different class references about UIVie...

Is there any way to merge two NSMutableArray in objective c?

I have two NSMutableArray filled with data object. how do I compare both array and merge if any change found. ex: Array1= index(0) userName = {'a',1,'address'} index(1) userName = {'b',2,'address'} Array2= index(0) userName = {'c',3,'address'} index (1) userName = {'b',2,'address'} Result is: Array= index(0) userName = {'a',1,'addr...

iphone sdk: How do i hide the tabBar in my UITabBarController?

Hi, My application consists out of a tabbarcontroller and inside i got multiple navigationControllers. Now i want to hide the bottom bar of the tabbarcontroller from the start because the buttons on the bottom bar lead to features inside the application which are just not ready yet so i dont't want the user to see them. How do i do this...

How to reduce the size of uiscrollview from top

Hi to all, i am creating a music application in which i am adding a scrollview to uiview.and another view is without scrollview. I want to reduce the size of scrollview from top. When I reduce the size of scrollview it gets reduced from bottom and that is a problem. This is my code for scrollview. scroll = [[UIScrollView alloc] initWit...

Create game sprites in Interface Builder?

Something I'm not very clear on is whether I should/could use interface builder to create reusable game sprites. For example, if I have a ball that I want to create an indeterminate amount of at run time, should I be creating a nib file (and either attaching graphics in IB or drawing them in drawRect) with it's own viewcontroller class a...

converting ID events to void events

Is it possible to convert this: - (id)initWithFrame : (NSRect)frame { if (self = [super initWithFrame:frame]) { [self setFont:[NSFont fontWithName:@"Arial" size:0.0]]; // [self startTask]; } return self; } to make it a void? thanks, Elijah ...

I sometimes see a small letter preceding an object (?) What is that about? Example below.

- (id)initWithFrame:(CGRect)frame viewController:(LevelViewController *)aController; What's the small a for? When I see a small k, I'm assuming it's for constant. ...

Problem with leaking NSStrings.

My code leaks but I do not know exactly what am I doing wrong. Simply I have a function that takes array with NSStrings and outputs NSString formatted as CSV. Here is my code: -(NSString*)generateCSVfromArray: (NSMutableArray*) reportEntries { NSString* accumulator = [NSString stringWithString:@""]; for (NSString* string in r...

Core Data Crashes When Trying To Save After Delete

I am having problems with the context in Core Data not being able to save. I get random crashes when I try to call [context save:]. Sometimes it works, sometimes it doesn't and crashes the app. Here is my delete code. I have been able to reduce the number of crashes by checking if [context respondsToSelector] save. The strange this is e...

objective-c delegates and events design (I don't get it)

Hi I'm pretty new to the objective-c language (less than three month) but is something that i really need to understand. Suppose a controller (in a iOS environment) that manage a table view for input data from the user. The table must have a editable cells and some features for make the value selection easier, for example a button that...

how to make UITableViewCellEditingStyleInsert button call insertNewObject

... i am sure this is a basic question, so thank you in advance. i add a cell to the end of a section when in editing mode and i give it UITableViewCellEditingStyleInsert. how do i set what function that button calls? ...

How to calculate?

Hi everybody, I just tried to calculate something. All my input is int. int aveScore = (startScore/((([p1.arrayThrow count]-1)) + winPane.throws)); The result is (for startscore = 501 and the rest = 3 [501/3 = 167]) 100. Even tried float aveScore which results in something like 10359. Also didn't work: int aveScore = (float) ... ...

Put jSON encoded array as NSData from NSURLResponse into NSArray

I'm unable to get this to work: NSString *post = [NSString stringWithFormat:@"userudid=%@", [udid stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; NSLog(@"%@",post); NSData *postData = [NSData dataWithBytes:[post UTF8String] length:[post length]]; //[udid dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES...

Create UINavigationController programamtically

Hi all, Just because I am unable to find a secure way (in a sense that it can be rejected by Apple guys) to customize UITabbar, in particular UITabBarItem I am trying some workaround. I have a main view on wich I recreate a kind of UITabBar, a normal view with two buttons inside. This is (roughly) the current hierarchy: -MainView --pl...

What's the most fun: AS3/Flash or ObjC/Cocoa/XCode ?

It's a question for people who know both AS3 & ObjC. I know a little bit of both, but can't decide which would be the easiest language to learn & the most fun to use on a professional level. And why? Fun as in, most exciting & most interesting. ...

Custom use of MKPinAnnotationView

Hello all, Is it possible to use MKPinAnnotationView controls in a application that has nothing to do with maps. I do not want to use MKMapView, I just want to reuse the MKPinAnnotationView control and be able to drop it at a specific screen coordinate. Thanks, Cristian ...

Is using respondsToSelector: good style?

Is it "better style" to send a message and hope the object responds, or to check to see if it responds to a selector and have some sort of fallback if it doesn't. For example: - (NSString *)stringForObjectValue:(id)obj { if ([obj respondsToSelector:@selector(intValue)]) { NSString *roman = [self formatRomanNumber:[obj intVa...

IPhone Memory Management: What do I need to release inside dealloc?

So say in my viewcontroller's .h file I have: @interface MyViewController : UIViewController { IBOutlet UILabel *myLabel; IBOutlet UIView *myView; IBOutlet UIImageView *myImageView; IBOutlet UIButton *myButton; NSNumber *myNumber; NSString *myString; NSMutableArray *myArray; UILabel *myCurrentLabel; SomeObject *myObject; CGPoint my...