objective-c

UIScrollView vs. UITableView

For a vertical scroller are there any advantages to using UIScrollView over UITableView? I ask because I am currently using two vertical UIScrollViews with UIImageViews inside of them and am having memory issues and poor scrolling performance. I am not doing much with the scrollers, only highlighting images as they scroll into the cent...

Reading live output from shell script and updating progress bar

Hi, I have a shell script logging a list of numbers (1, 2, and so forth, one per line) to a log file. I need my ObjC app to read the log file every X seconds and then update my progress bar accordingly based on the last number logged in the log file. What's the best way to do this? ...

Proper way to add a title to a modal view controller's toolbar?

Right now I'm using this in my -viewDidLoad method: UIToolbar *toolbar = [[UIToolbar alloc] init]; UIBarButtonItem *flexibleSpace = [UIBarButtonItem alloc]; flexibleSpace = [flexibleSpace initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; // Add a back button to allow user ...

Tips on wrapping a C library in Objective-C

Hey Guys, I have a library written in C that I would like to use in an Objective-C app, either on the Mac or the iPhone. Unfortunately, since this library is being written by individuals in the open source space, the documentation is quite sparse and incomplete. While I can figure out how to use the stuff in the library, I don't really...

NSMutableString issue with NSXMLParser

I am having a heck of a time with this -- I am trying to parse an XML file and set the text in a NSMutableString variable in order to later fill in a label's text as you can see below. In my .h I have the following (simplified); NSMutableString *contentsOfCurrentXMLProperty; @property (nonatomic,retain) NSMutableString *contentsOfCurr...

Is string formation optimized by the compiler?

I was trying to answer another question about the == operator and I created this code: NSString *aString = @"Hello"; NSString *bString = aString; NSString *cString = @"Hello"; if (aString == bString) NSLog(@"CHECK 1"); if (bString == cString) NSLog(@"CHECK 2"); if ([aString isEqual:bString]) NSLog(@"CHECK 3"); if ([aString isEqua...

iphone how to check that a string is numeric only

HI , i am getting a string input from a UITextField i want to check that this string in numeric . how i will do that .. (numeric can have decimal points also) . how to do that ? ...

selecting a row by means of a button ... using didSelectRowAtIndexPath

hey people , I have a question concerning a button I would like to create which selects my previous selected row. This is what I came up so far but since I'm new with the functionality and such I could definately use some pointers I created a toolbar with a button and behind this button is the following action. -(void)clickRow { se...

How to change tint color of Cocoa's NSLevelIndicator?

Can the tint color of an NSLevelIndicator be changed at all? (setTintColor doesn't work) ...

How do i set a nested property if the object needs to be cast?

In my method to set labels in my cells (for a UITableView) I'm reading in 'id' thats actually a UITableViewCell since I'm reading in several different types of cells. ie. -(void)setMyCell:(id)cell atIndexPath:(NSIndexPath*)indexPath; Some of the cells are the generic UITableViewCellStyle type while others are more complicated and load...

How to remove NSString Related Memory Leaks?

in my application this method shows memory leak how do i remove leak? -(void)getOneQuestion:(int)flashcardId categoryID:(int)categoryId { flashCardText = [[NSString alloc] init]; flashCardAnswer=[[NSString alloc] init]; //NSLog(@"%s %d %s", __FILE__, __LINE__, __PRETTY_FUNCTION__, __FUNCTION__); sqlite3 *MyDatabase;...

How to print a float value nicely?

Example: I have a float value like 1294322.0000000, and I want to print it out in a label, like that: 1.294.322 So at every thousands-position one point inbetween. I bet you know what I mean. Don't know the exact english words for that. Or, for example, I have a float like that: 15.29, then it should look like "15,29". Or a float li...

Getting NSOutlineView rows to be editable

Hi, Does anyone here know how to make cells in NSOutlineView's editible? Im using the sampe code from apple and I cant seem to get it work at all. I am trying to set it up so that when you click twice in rapid succession on a cell in the NSOutlineView, the cell becomes editible so the user can update the text inside the cell. (In the sa...

editing PDF with PDFKit

i'm writing an application in objective-c (using cocoa). i have a PDF template, i need to substitute actual values into placeholders in PDF and then save the result into new PDF. how can i edit PDF with PDF Kit? can't find anything about editing in documentation, it's all about parsing... or maybe anyone will recommend other library to...

step by step debugging objective c

is there any way to see the step by step debugging of the code in objective C, like we use to do in Turbo C with the keyboard key of 'F7 / F8'. to see the line by line execution? ...

latitude/longitude

Is there any way to find out the latitude/longitude of a place using IP address. ...

Is it a good idea to prefer NSNumberFormatterBehavior10_4 over NSNumberFormatterBehaviorDefault?

I wonder if it would be more secure to rely on a NSNumberFormatterBehavior10_4 instead of default, because default may change arbitrary some day in future, and suddenly the app looks ugly. Or am I wrong with that? ...

Deleting non-empty folders and specific file types.

What is the best way to remove a folder, deleting all subfolders and files? What is the best way to remove files with a specific extension; e.g., if I want to remove only files with '.txt' extension? Cocoa or carbon. ...

removeFromSuperView ...how can I remove all my components from every controllerview?

hello all , I have a question concerning UITableviews , the stack and removing components or possibly hiding components on the stack. first I have a function which adds a component (a button ); -(void)addComponent { [self.navigationController.view addSubview:playButton]; } I call this function in my didSelectRowAtindexPath So f...

Finding a string in a string

Hi, Does anyone know a nice efficient way of finding a string within a string (if it exists) in objective c for iPhone Development, I need to find the part of the string in between two words, e.g. here I need to find the co2 rating number in the string, where z is the value I'm looking for ... xxxxxco_2zendxxxxxxx Thanks Richard www...