objective-c

opening iWorks documents in iPad UIWebView

Hello, I'm writing an iPad application that has a UIWebView which I open word and excel documents in, but I want the user to be able to import those documents into the iWorks applications, Pages and Numbers, just like how you can do it in Safari if you open a document. If you open a document in Safari on the iPad, there'll be a button ...

TouchXML parsing error

Hi, I have a xml document which has only one element in the document. This is the whole document. <?xml version="1.0" encoding="UTF-8"?> <error>key ! is invalid</error> But when i try to parse it, it says this document has no element at all. In other words when i try to access the rootElement it says "null" Here is the code i am usi...

Play video in UIWebView from NSData

Hello there, Does anybody know how to play a video in a UIVebView ? The video comes from the iphone library, when I pick it, I store it in core data as binary data. If i use the local url of the video it's working fine, the problem I have is that the this url refers to a folder named "tmp", and I don't know the lifetime of it. If I ca...

Calling class methods via self

I have some class methods in a class with a pretty long name (TimingConfigController to be exact), and I call those methods quite often from within the class (example: [TimingConfigController intervalStringAt:i]), but the long class name bothers me because the statements get very long and less readable with all that inlined. I was readi...

fetch data from sqlite as an integer using iPhone

hi.. How can i fetch the data from sqlite as an integer in iphone technology. I have fetched the data as a string that code is mentioned below,now what have to chage in this code by which i can fetch the data as an integer. Please help me out. databaseName = @"KNAJ.sqlite"; NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(...

How can i see if dealloc is being called on a uikit object, or any object not created by myself

I think i have an UIImage that has a higher retain count than it should have and i am probably leaking memory. I use this image as a thumbnail, to set a custom background to a uibutton. So the uibutton is holding a reference to it and so do i. But instead of 2, the retainCount is 3. Do i have to create a custom UIImage derived class and ...

Variable height UIViews and labels

Ok so I'm not in a table cell at this point. (I've seen a lot of threads regarding the height of cells.) I have a detail view with a title and description at the top of the view, followed by a tableView below it. If the description is going to vary in length, how do I get the tableView to adjust with it accordingly so it always starts d...

Crash on replacing map annotations

Solved it, see below code I'm trying to replace annotations on my MapView depending on the distance between user location and annotation. The annotations are getting replaced like they should, but when I touch te mapview my app crashes. This is de code I have so far: NSMutableArray *tempArray = [[NSMutableArray alloc] init]; for (...

how to change orientation of a particular portion of a View iPhone

I would like to change orientation of lower half of my view similar to stock app in which when we change the orientation of device only the Graph view of the same rotates. Please let me know how I would achieve the same functionality. ...

Advice using leaks in instruments for noobs

Hello I am pretty new to iphone development. I have run my app for the first time using the "Leaks" from "Instruments". It shows me several leaks around 20 the smallest is 32 bytes and there is one with 1KB. I have followed the memory management guidelines, (i (think i) understand how and when to use release, not to use it when adding to...

Objective-C: Cannot Change Value of Instance Variable Inside a Function

Hello everyone, I cannot change the value of an instance variable inside a function. I have defined a class: // info.h #import <Foundation/Foundation.h> @interface NSMyObject : NSObject { NSInteger i; } -(void) setI:(NSInteger)v; @end #import "info.h" @implementation NSMyObject -(void) setI:(NSInteger)v ; { i=v; ...

'-respondsToSelector:' not found in protocol(s)

Hello i have received this message ever since i started building my first iphone program several months ago. I check if a delegate implements a given method. It works but I get this warning. How can i do it the correct way? Thanks in advance. ...

UITableViewCell repeating problem

I have a UItableview with cells. Some cells have uilabels and some have uibuttons. The UIbuttons are created whenever the first character in an array is "^". However, the uibuttons repeat when i scroll down (appearing over the uilabel).. and then multiply over the uilabels when I scroll up. Any clues why? ...

variables declared in @implementation

Hello, I'm working through a code listing from a book and it has a pair of variables (specifically NSString *) declared and initialised in the @implementation rather than the @interface but outside of any method body. I've not seen this before and I'm wondering what the difference this makes in scope and so on. I've had a quick look in ...

UIView remove itself from UIScrollView

Hi! Following Scenario: I have a = UIViewController A that contains a UIScrollView I have a second UIViewController "B" (amongst other things it contains a button) and add it to the ScrollView of A myView *mView = [[myView alloc] init]; [myScrollView addSubview:mView.view]; Is there a way that once the button is pressed that it(view...

Access call log in iPhone

Hi All, Can I access the call log of iPhone through application. Is this feature added in iPhone OS 4.0??? As what ever I searched for OS below 4.0 and it is not there. Thanks in advance, VIshaL ...

Objective-C : expected ']' before ';' token

Trying to follow some basic examples and getting stuck by this code that is EXACTLY like the example I am following: [[NSUserDefaults standardUserDefaults] setObject:@"Sample Text" forKey:kWordsOfWisdom]; gives me the error: expected ']' before ';' token ...

Possible causes of black(iphone-touch) screen on(after) launch?

I have a simpe window based application that loads a series of images on launch. Only one nib(MainWindow.xib) with a UIView and UIToolbar. It WAS working, both in the simulator and external device. I had some SDK issues for a while(I had removed needed SDK's) but it is now compiling again without errors and I see the launch image corr...

Creating UITableViewCell programatically

I want to create a tableviewcell and add it on the view(not tableview) as CGRect aframe=CGRectMake( 20, 20, 200, 200); UITableViewCell *cell =[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil]; cell.frame=aframe; [self.view addSubview:cell]; But this is not working at all. Can't we create cell inde...

Why are these class methods needed when there are perfectly fine parent class methods?

Why are class methods such as + (NSMutableArray *)array; needed when there are perfectly fine parent class methods such as + arrayWithObjects:(id)firstObj, ...; which could be set to [array arrayWithObjects:nil] and have the same effect. Are they actually not equivalent things? ...