objective-c

iPhone telephone api?

Hi everyone, Is it possible to access active calls on the iPhone (with or without jailbreak)? Best, Stefan ...

Can't create an NSImage?

Whenever I do: xxx = [NSImage imageNamed:@"Package.png"]; xxx loads but it's width and height remain 0. And whenever I try loading it into an NSImageCell I get this error: NSImageCell's object value must be an NSImage. Can someone help me out? I've never had this problem before. Edit: Sorry, I've missed this bit out. So when I ...

iphone: memory leak problem: message sent to deallocated instance, why?

Hi guys, here is the problem, today I had a bad time debugging my project, the console said: [CFString release]: message sent to deallocated instance 0x12345 I found the problem, and also, the solution, but I'm not sure why the error happened. -(BOOL) sendRequest:(NSString *) message { //xml -> data NSString *xml = [self toXML:messa...

Subtle memory management issue in Objective C

I recently (after hours of debugging) tracked down a segfault in an Objective C iPad app. To boil it down, I had an object TOP which owned MIDDLE which owned BOTTOM. MIDDLE and BOTTOM had retain counts of 1. MIDDLE passed BOTTOM to a method in TOP which ended up releasing MIDDLE, thereby causing BOTTOM to be released and dealloc'd. W...

Why can't I assign variable value directly?

I am new Objective C. I am trying to understand and workout problems from Stephen Kochan's Programming in objective c 2.0. This problem is from chapter 8. What I don't understand is: why can't I assign variable values directly when I can get them. For example: This does not give me a error or warning. But it also does not set the v...

NSDecimalNumber for intensive scientific applications?

Let's say I'm writing a "DayData" class, containing the ivars NSString *symbol; //such as "AAPL" NSString *currency; //such as "USD" NSDate *day; double open; double high; double low; double close; The last four ivars are the open,high,low,close prices of that stock for that day. Say I'm using this class as the fundamental building-...

How can I make a View scrollable in iPhone?

I want to make a long view, for example, 3200*240, whatever. Now, I want to the user display from start from 0,0. When the user scroll right, the x index will increase 320. So, I need a scrollView on top of the UIView to detect the scroll? Also, I need to have a UIScrollViewDelegate, right? thank you. ...

Why the UIScrollViewDelegate is not working?

I have a viewController called "HaveScrollController", and this is something like this: @interface HaveScrollController : UIViewController <UIScrollViewDelegate>{ IBOutlet UIScrollView *scrollView; IBOutlet UIView *firstView; IBOutlet UIView *secondView; IBOutlet UIView *thridView; IBOutlet UIView *fourthView; } @p...

Nested NSArray/NSDictionary Problem

I have an NSArray containing several NSDictionaries. I have an NSString containing an ID string. What I'm trying to do is iterate through the NSDictionaries until I find the object that matches the NSString. Then I want to return the entire NSDictionary. I'm fairly new to iPhone development, so I'm probably missing something obvious.....

When to retain in objective C?

I have been writing objective c for couple of weeks. However this question still bothers me a lot. Can anyone explain in pain english: When to retain an object? Thanks ...

Can we know the contents of NSBundle in Xode project?

Hello, How to know the contents of NSbundle in XCode Porject?? bcoz issue is, I have placed a config.doc file in resource folder of my XCode project and i want to read the contents of that config.doc file, but it says that config.doc file is not found. How to solve this problem?? This is how my code looks like: -(void)applicationDid...

iPad Rotation and Keyboard pop up

I'm building an app that uses a UIView that contains a UIScrollView within it so that when the keyboard shows up, users can still scroll downwards to see the content within the view. It seems like I have gotten everything perfectly set up but when I rotate, everything goes completely unusable. The views are all out of place and I am unsu...

How to response to vertical scroll only on iPhone?

I have a scrollViewAppDelegate, which is have a method called: - (void)scrollViewDidScroll:(UIScrollView *)scrollView How can I detect the vertical scroll only? thank you. ...

adding multiple views in your app

I am working on an app in which the starting point is a map and it has a button too. What i want is that if user clicks the button it will take him to another view which just have two or three buttons or other elements. Please provide me with detail answer so that i would be able to do it. Thanks in advance, i would really appreciate i...

How to addSubview with a position?

I have something like this: myViewController = [[MyViewController alloc] initWithNibName:@"MyView" bundle:nil]; [mainCanvas addSubview: myViewController.view]; self.view = mainCanvas; It will added on the position (0, 0), but I want to add on 0,100 or somewhere else, how can I do so? thank you. ...

distinct Objective-C type Problem

Hi I am having a problem. I have declared a method in my NetManager class with following signatures -(void) getLiveMatchesListScreen:(AutumnViewController *)dataListener initialSleep:(long)initialSleep { Where AutumnViewController is my custom UIViewController. @interface AutumnViewController : UIViewController { } Now I am trying ...

How to read the contents of .doc file into string in XCode?

How do I read the contents of .doc file [not from resource file] into NSString in Objective-C? I tried doing it in this way: NSString *str = [NSString stringWithContentsOfFile:@"/User/home/Documents/config.doc"]; NSLog(@"Contents of file : %@",str); OUTPUT: -+-% [encoded format] output is in encoded format How do I solve this probl...

problem in DismissPresentModalViewController

I am making a application in which i go from one view to another with presentModalViewController and from that view to another view with presentModalViewController now i want to go back (one view back ) with dismissModalViewController and i called this method from appdelegate but it causing msg_trap error .. Thanks. ...

MPMoviePlayerViewController in a

I have a view controller that's been added to a UITabBarController. In this view controller I have a button that opens up a movie using MPMoviePlayerViewController. When I play the movie, the top navigation bar is still overlayed on top of the movie, effectively blocking out a portion of the screen. When this view controller isn't in...

How to get the Zoom Levels and Lat and Long values of the Map when Zoom in/out.

Hi all, I am implement an application based on the MapKit using iphone sdk.I just now a method to get the event when we drag, zoom in/out on the map. The method is as like this (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated Now I need to get the following bullets. 1.TopLeft's and Bottom Right's Latitude ...