objective-c

How to reload a uiviewcontroller on the iPhone

Hi, I'm trying to reload a value I set on UIViewController to update each time I transition with this code (coming and going are both UIViewControllers): coming.phoneNumber = aPhoneNumber; [coming viewWillAppear:YES]; [going viewWillDisappear:YES]; [going.view removeFromSuperview]; [self.window insertSubview: coming.view atIndex...

Does NSNumber add any extra bytes to the number it holds?

I'm working with Objective-C and I need to add int's from a NSArray to a NSMutableData (I'm preparing a to send the data over a connection). If I wrap the int's with NSNumber and then add them to NSMutableData, how would I find out how many bytes are in the NSNumber int? Would it be possible to use sizeof() since according to the apple d...

Multiple UILabels to display decorated XML markup

I have a block of content (stored in XML) that I want to put in a UIScrollView. Certain parts of this text will be formatted with different fonts, sizes, and colors. Altogether, it mostly reads as a paragraph with word wrapping. I've built my NSXMLParser code, and I have separated all the data. I'm ready to apply my decorations and...

round NSDate to the nearest 5 minutes

For example I have NSDate *curDate = [NSDate date]; and its value is 9:13 am. I am not using year, month and day parts of curDate. What I want to get is date with 9:15 time value; If I have time value 9:16 I want to advance it to 9:20 and so on. How can I do that with NSDate? thx ...

Persistent Storage Cocoa/MacOSX

When writing an application for MacOSX, using Cocoa/Objective-C, I'd like to be able to store the data entered by the users. There will only be one user per installation at the moment; however, I'd like to get an idea of how storage methods change if it were multiple users per installation. In the case of 1 user per installation, shoul...

getting my dictionary tree from my xmlparser class.. to my drilldowntableappdelegate file

Hello all , I seem to have a probably newbie problem but here it is. How do I get my dictionary from my parser class , which has building a tree for a drill down table back to my drilldowntabledelegate class. my app looks something like this. @implementation DrillDownAppAppDelegate @synthesize window; @synthesize navigationControl...

comparing object attribute in one array to an object attribute in another array

Hello all ... i seem to be having difficulties in accessing and comparing objects in NSMutableArrays in objective c. I'm very new so when explaining , some code would be nice. I have a character class and a characterfound class. The code looks like this: @implementation character @synthesize IDE, name; - (void) dealloc { [text ...

How do I disable warnings being flagged as errors in XCode

Is there a setting XCode that lets you treat warnings NOT as errors in XCode? I'm doing alot of prototyping code where I don't care if I have an unused variable for example. XCode is treating these warnings as errors and it is seriously slowing down my productivity. Can't figure out how to disable this though. ...

UISlider setValue "Leaking"

Hey hope someone can help as I am at my wits end with this!? I have a UISlider. I would like it to move as progress of a task takes place (playing music). Im setting its value as the continues events happen. (progress through the track) -(void)updateSlider:(float)value { NSLog(@" %f ",value); [timeIndexSlider setValue: value ...

XCode compiler warning: 'foo' may not respond to -bar

Hello, I'm trying to get my head around Objective-C for the iPhone. My app is compiling and running just fine so far, but I'm getting a compiler warning that I cannot get rid of. Header for one class: (snipped) @interface PersonDetailViewController : UIViewController { NSDictionary *person; } @property (retain) NSDictionary *perso...

Is it ok to use "classic" malloc()/free() in Objective-C/iPhone apps?

I've been playing around with iPhone development for a while, and although it feels a bit awkward when you're a "hard core" .NET developer, it's not all that bad once you get used to it. In every book I read about Objective-C, there's only talk about retain/release (reference counting) for memory management. As an old-skool C/C++ develo...

Removing the bar in standard UITableView programmatically

Does anyone know if it's possible to remove the topbar from a UITableView in code? So in this case, remove the "Books" bar? ...

Using IB to add a UISegmentedControl to a NavigationBar

I'm current creating a UISegmentedControl programmatically in a view controller's viewDidLoad method and adding it to the view controller's navigation bar by assigning it to self.navigationItem.titleView. That's easy enough, but I'd like to be able to do this in Interface Builder as well and so far haven't been able to figure out how. ...

returning index array objective c

Does anyone know a quick way to return the index of my array in a simple function something like this if([appDelegate.exerciseReference containsObject:aExerciseRef.IDE]) { //return indexofwhere the object is the same .... } so let's say these two are the same at the index:5 from my array it would return a 5 integer. ...

Button not removed with removedFromSuperVire

Hi, I'm using the trick to put a custom button for the numeric keyboard. But I can't remove the button after use it, so in regular keyboard appear on top of the view. This is how I add it: - (void)keyboardShow:(NSValue *)v { if (isKeyboardNumeric) { // create custom button UIButton *doneButton = [[UIButton alloc] init];...

Asking if an object is invalid

Hi I am trying to determine if an object is valid. The program has (at least) two threads and one of the threads might invalidate the object by removing it from an NSMutableArray. I need the other thread to check either its existence or validity before acting on it. ...

Can I localize a UIDatePicker?

I'm trying to localize a UIDatePicker. Apple's docs say that it should autodetect the current locale, yet the language stays the same, no matter what language I select. What do I have to do? ...

Determine whick part of the UITableView cell was tapped

Is there a way to determine where in the cell was tapped? I am currently using tableView:didSelectRowAtIndexPath but this only tells me that the cell was selected. ...

OS X Get highlighted text

Hi, I'm interested in writing a plugin for OS X to support multiple operations on highlighted text in the right click context menu. The operations are simple enough that I could write them by myself. I've looked at automator's "Copy to Clipboard" action, but it requires some text input first. The "Get contents of Clipboard" action will...

How to save data in a text file as the user presses the home button on iPhone?

I want to save my data into a text file when the user presses the home button. How to do so? ...