objective-c

iPhone / Objective C - Communication between ViewController / best way to implement?

Hi, I'm doing a iPhone app. I created my own SwitchViewController Class (linked to the App-Delegate) which actually just changes the various other Views / ViewControllers (e.g ViewA, ViewB) while the app is running. When I know recieve a tap-gesture in the ViewController-A I would like to trigger a method (eg. switchViews:(id)sender) ...

didSelectRowAtIndexPath working on simulator not iphone

Hi all, Hopefully a nice and quick one for you... the below code is working fine on the simulator, but not working on the iPhone, any ideas? - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if([[dataTable cellForRowAtIndexPath:indexPath].textLabel.text isEqualToString:@"Telephone"]){ ...

Resign keyboard when leaving textfield

Hey, I have created a textfield within two custom cells. One textfield shows the standard keyboard and the other the shows a pickerview when entered. The problem I have is when I move from the keyboard to pickerview textfield without clicking the "return" button on the keyboard, the keyboard doesn't resign. However when I do it using the...

how to display just 10 rows in uitablView iphone application.

hi all. I have a large data to be displayed in Tableview cell can anybody tell me how to show just 10 of them after click display button. and then add more 10 when user click on load more button. Thanks in advance. ...

gcc -x objective-c with Android SDK

Since Objective-C exists and is supported even in MinGW, by passing -x objective-c, is there a hack to achieve this with Android SDK? I've did a rudimentary test on a colleague's machine where it appears that language objective-cis not supported. I am not interested in getting UIKit or AppKit, or even Foundation, to work; I've written m...

How can I make a NSDateFormatter accept input in one format and display it in another?

I have a table view that displays dates using a NSDateFormatter to format them using the Full date style (today would be formatted as "Friday, September 24, 2010" or in German "Freitag, 24. September 2010"). But when editing the date the formatter forces the user to type the date in the same format. How can I make the formatter accept da...

What's a canonical example of code kata to learn about pointers ?

I've never worked with a language that didn't provide for some form of memory management, and thus managed to get by without ever really groking pointers. I can dabble in C I guess, as a result of coding in Objective-C for a little while. ...

NSMutbleArray - add/remove objects with properties - leaks

Hi guys, i have a leak issue in my app. I'm trying to add and remove objects to a NSMutableArray. Here is the class Demande : @interface Demande : NSObject { //attibuts de la classe demande NSString *demId; NSString *demStatut; NSString *demTitle; NSString *demCreated; NSString *demIdCopro; NSString *demIdImmeuble; NSString *demIdLo...

Error: Conversion from 'objc_object*' to non-scalar type 'CGSize' requested. Please help?

The following line is throwing the error, what's the matter with it? CGSize size = [label sizeWithStyle:style forWidth:bounds.size.width]; My code: MSHook(void, drawRectLabel, SBIconLabel *self, SEL sel, CGRect rect) { CGRect bounds = [self bounds]; NSString *label(MSHookIvar<NSString *>(self, "_label")); NSString *style ...

Problems with an unusual NSOpenGLView setup

Hi, This is a bit long, so feel free to skip to the numbered parts if you want to avoid the lengthy intro. I'm trying to set a subclassed NSOpenGLView in an unusual way and I am running into some problems. Basically, I am writing a program to perform a bioengineering simulation for my PhD and I need to be able to compile it under both ...

Problem with the leak at status parser method in libxml

Hi all, I had a problem with the LibXMLParser when I ran it in the instruments. the following is my code that I used. - (id)statusParser { return [[[self class] alloc] init]; } The memory is leaking at return method. Please help me it is very urgent. Thanks in advance, Sekhar Bethalam. ...

UIButton not showing in UIScrollView

This is my code, been at it for awhile, but still can't get it to work. suggestionScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 44, 320, 44)]; UIButton *button = [[UIButton alloc] init]; button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; [button addTarget:self action:@selector(aMethod:) forControl...

How do I convert a string into an integer in objective C?

I am trying to convert a user's guess into an integer. How do I do that? ...

How to make the customized preview for video captured with UIImagePickerViewController in Iphone sdk?

Hi Guys, I need to customize the preview of captured video taken with UIImagePickerController. Guy Iam struggling about this.Please any one help me to get out of this problem. The Code I written: - (BOOL)startCameraPickerFromViewController:(UIViewController*)controller usingDelegate:(id<UIImagePickerControllerDelegate>)delegateObject...

Expected specifier-qualifier-list before '*' token Objective C

Hello Would anyone be kind enough to explain to me what I'm doing wrong. I'm giving it : #import <Foundation/Foundation.h> @interface Product : NSObject { NSString *imageAddress; NSString *name; NSString *title; } @property (nonatomic, retain) *imageAddress; @property (nonatomic, retain) *name; @property (nonatomic, re...

How To Use the CHCSVParser class

Hello all (but mostly Dave), I am playing around with Dave DeLong's excellent CHCSVParser for Objective-C with an extremely long .CSV file and am running into some trouble using it. I would use the arrayWithContentsOfCSVFile method, but I'm running the code on an iPhone and parsing the whole file into memory would take more memory than...

Error : getting an object from an NSMutableArray - objective C

Hi, I have the following code: Product product = [[Product alloc] init]; product.title = tag; [allProducts addObject:product]; NSString *pImage = [[NSString alloc] initWithFormat:p.title]; But it is failing to return anything Can anyone kindly help me please? THanks ...

ViewWillDisappear versus dealloc

I put an NSlog in my dealloc method of my view controller. It does not get consistently called. I do notice that ViewWillDisappear does get called always. Would it be ok to move all my tidy upcode here? Setting stuff to Nil and release calls. Anybody got some advice on why dealloc is not getting called? I know it says in docs it may no...

Adding UIToolbar with two UIBarButtonItem to a UINavigationBar: poor UIToolbar and what about iPhone 4

I'm following the second tip from here. In this tip two UIBarButtonItems are put together in a UIToolbar. Finally, the UIToolbar is added to the UINavigationBar. Now to my problems: 1) A white line is on top of the UIToolbar. If I increase the size of the UIToolbar, the gradient is wrong. I'm using the following size for the UIToolbar: ...

Edit UIDatePicker with button?

Hi In my app I have next and previous week buttons, but also a UIDatePicker. So lets say I press the net week button, how can I adjust the day in the UIDatePicker to increase by 7 days? And visa versa for back 7 days. Thanks! ...