objective-c

One Root view controller , Manages all other views?

Hi guys, I was just wondering if its normal for an app to a have one root view controller which gets passed other view controllers and switches betwen them ? - in other words there is one view controller which switches between all other views. So one root controller manages all the other views ( so in a large application for the sake o...

Convert hex data string to NSData in Objective C (cocoa)

Hi, fairly new iPhone developer here. Building an app to send RS232 commands to a device expecting them over a TCP/IP socket connection. I've got the comms part down, and can send ASCII commands fine. It's the hex code commands I'm having trouble with. So lets say I have the following hex data to send (in this format): \x1C\x02d\x00\x...

I want to know how to sort the dates in objective c ?

how to sort date using nsarray ? I have four dates , that should by display by ascending order.can you explain how to sort ? I searched so many stuff, but i can't ablt to find any thing .Please help me , is there any method for date sort. ...

Compare value doesn't work (Objective-C)

Hi, In my tableView at the numberOfRowInSection, I try to compare myDate inside self.date to dateInFiche inside self.allDates. my date is like: 12-05-1986 in the For statement dateinFiche will have those value: 12-05-1986 12-05-1986 13-05-1986 18-05-1986 When the if statement occurs the first date is the same so it will increment the...

Sorting NSSet throws exception valueForUndefinedKey

I'm trying to sort an NSSet of NSManagedObjects. The value for one of the set item's "pubDate" property is nil. The following code throws an exception [NSManagedObject valueForUndefinedKey] when it is sorted. How can I get it to ignore the element without a value for that key? NSSortDescriptor *sortNameDescriptor = [[[NSSortDescriptor...

Objective C: warning on overriding init

I have a class 'DOInstance' which I inherit later on. Here's its declaration: @interface DOInstance : NSObject { } - (DOInstance *) initWithSynckey:(NSString *)_synckey; @end Then I have a subclass of DOInstance: @interface Workflow_Workitem_Header_1px: DOInstance { } //- (Workflow_Workitem_Header_1px *) initWithSynckey:(NSString ...

How to check Object At Index in NSMutableArray

Hi, I have a NSMutableArray, I want to insert data inside it, the problem is first I wanna check if the index where I'm inserting the data exist or not, but how to do that. I try something like that but nothing is working: if ([[eventArray objectAtIndex:j] count] == 0) or if (![eventArray objectAtIndex:j]) Thanks, ...

iPhone memory leak and release problem on sorted array

Hi, I'm having some troubles with the code below: NSSortDescriptor *idDescriptor = [[[NSSortDescriptor alloc] initWithKey:key ascending:ascending] autorelease]; NSArray *sortDescriptors = [NSArray arrayWithObject:idDescriptor]; NSArray *orderArray = [array sortedArrayUsingDescriptors:sortDescriptors]; NSMutableArray *result = [NSMuta...

How can I create a ToggleButton in Obj-C? Skin the UISwitch or subclass the UIButton?

How can I create a ToggleButton in Obj-C? Skin the UISwitch or subclass the UIButton? ...

Accessing a global varibile in any class

Hey all i have been trying to figure out why i am getting this warning: 'TxtAppDelegate' may not respond to '-TCN' 'TxtAppDelegate' may not respond to '-TID' when i try to use this code: // .h file @interface RootViewController : UITableViewController <UIActionSheetDelegate> { NSString *theCompanyName; NSString *theID; } @prope...

Changing how IKImageBrowserView indicates the drop position

I can make a single row IKImageBrowserView by setting the [imageBrowser setContentResizingMask:NSViewWidthSizable]; but in this case while i drag an image inside image browser to rearrange it, the drop place highlights with horizontal line(vertical line expected). how can this be changed? Many thanks. ...

number of elements in NSMutableArray

How to know at runtime how many array elements are there in NSMutableArray? ...

Error saving NSImage as NSData

Hi there. I am using the following code to save a frame of a movie to my desktop: NSCIImageRep *imageRep = [NSCIImageRep imageRepWithCIImage:[CIImage imageWithCVImageBuffer:imageBuffer]]; NSImage *image = [[[NSImage alloc] initWithSize:[imageRep size]] autorelease]; [image addRepresentation:imageRep]; CVBufferRelease(imageBuffer); NSAr...

Use two TabBarController

Hi, I want to use two different TabBarController. Everything is declared in my AppDelegate. Here is the result : TBC1Tab1 | TBC1Tab2 | TBC1Tab3 and then when I push a button my new TabBarController : TBC2Tab1 | TBC2Tab2 Each Tab is linked to a view. I use a button on my first tab to go to my second TabBarController with my new tabs. My...

Design cell make UITableView slow

Hi, Here is my problematique: I design my cell in my UItableView, so I added a title, a little description and an image. All thoses element are store in my database, so in my UIViewController I calculate every position to have a nice cell, if there is no image in a cell I change the position of the title and the little description. To ...

Storing texture name in objects - obj-c

I'm in the process of learning opengles / obj-c and creating an app for the iphone that will render multiple 3d models. I've created an object that stores all the important details such as vertices / faces / textures etc but I also want to store the texture name that is currently being used on the model. In my CustomModels.h file I have:...

Objects not being added to NSMutableArray Objective -C

Hi, I'm trying to simply add objects to a mutable array but they WILL NOT insert. I'm not getting errors or anything and I can't figure out whats going on. In my main delegate file I split an array into 4 separate strings like so. NSArray *split=[currentParsedCharacterData componentsSeparatedByString:@"|"]; NSLog([split object...

Abstract design / patterns question

I had a bunch of objects which were responsible for their own construction (get properties from network message, then build). By construction I mean setting frame sizes, colours, that sort of thing, not literal object construction. The code got really bloated and messy when I started adding conditions to control the building algorith...

curl down transition for adding an UIView to a superview

now sometimes things just don't work as expected. my UIView has a method to add itself to a given parent view like this -(void)showPanelInView:(UIView*)view { self.hidden = YES; [view addSubview:self]; [UIView beginAnimations:@"categories_panel" context:NULL]; [UIView setAnimationBeginsFromCurrentState:YES]; [UIView setAnimatio...

iphone problem - UIKit precompile error

I've been working on a project for a few weeks now and today is the last day before it goes to client (typical). For some reason Im suddenly getting the following error when building my project (sim or device), even though other projects build fine /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.3.sdk...