iphone

iPhone: How to Embed NSData in XML for Upload to Server?

Hello, I want to pass data to a server and store the file there in a database as binary data. NSData *myData = [NSData dataWithContentsOfFile:pathDoc]; pathDoc = [NSString stringWithFormat:@"<size>%d</size><type>%d</type><cdate>%@</cdate><file>%c</file><fname>File</fname>",fileSizeVal,filetype,creationDate,myData]; Any idea abou...

iPhone Full and Lite version without StoreKit

Hi there! I have a Full and Lite applications that were built from the same code. Lite version has a button Upgrade. What code I should place in button's handler for checking users payment and update application to Full version?? I know StoreKit framework that allow to unblock some features, but I need just 2 different applications. Ma...

Scale down WebView content in iphone App

Hello, I am looking to display multiple web content in one main view. I have created different WebView and make it's height and width to fit all in one view size of Landscape mode. How to scale down web view content to show data in small size (as per WebView height and width) ? I have built application using Interface builder.The vi...

glBindTexture Problem with OpenGL ES on iPhone

I'm new to OpenGL, and am having a curious problem with my textures - looking for a nudge in the right direction. I have an app which uses a Render to texture technique for accomplishing a certain effect - it's working marvelously. I draw to an offscreen buffer every time I need to, and am able to use this as a texture in my render loo...

iPhone events handling

Hello, does anybody know how can I handle the events(touch, drag) in UIApplicationDelegate instead of UIView? ...

Why can't I save changes to application settings with NSUserDefaults?

I am using the following code to save values from a settings view that takes values from a UITextField and stores them with NSUserDefaults. The code below even calls synchronize yet it is not saving the changes. What am I doing wrong here? - (IBAction)save { NSLog(@"save"); NSUserDefaults *defaults = [NSUserDefaults standardUse...

how do I POST a jpeg to a web form the way a browser would?

I need to upload a file to a form. This is a generic browser based upload I want to mimic. I have looked through the HTML documentation but I can't figure out how it works. right now I am using a URL to submit the rest of the form information "www.domain.com/form.html?field=value&field2=value2". This is all there is to the HTML for the...

Fastest image drawing method on iPhone

I am trying to draw images to the iphone screen by changing the images of a UIImageView in a loop. But since there was no much response on the screen than two or three images being drawn and skipping others I need another method. I am trying to show 80 png images that are 320*480 in size at 30 images per second. Please suggest the fast...

How to pass touch from a UITextView to a UITableViewCell

I have a UITextView in a custom UITableViewCell. The textview works properly (scrolls, shows text, etc.) but I need the users to be able to tap the table cell and go to another screen. Right now, if you tap the edges of the table cell (i.e. outside the UItextView) the next view is properly called. But clearly inside the uitextview the ...

What's the best way to release objective-c properties?

I'm new to memory-management, and am reading different things about how to best release properties. If I have: in .h: @property(retain) NSString *myStr; and in .m: @synthesize myStr = _iVarStr; Should my dealloc have: [_iVarStr release]; or self.myStr = nil; or something else? Thanks! ...

iPhone UIScrollView embedded UIView is clipped

Hello. I have an iPad UIView subclass (we'll call LargerUIView) with which I do a bunch of drawing via drawRect: once asked. That all appears to be working, and looks the way I like. I'm at the point now of trying to get scrolling working (just in the horizontal to begin), yet when I try to scroll, what shows below is black (ie, appears ...

How to convert and compare NSNumber to BOOL?

First I convert BOOL value to NSNumber in order to put it into NSUserDefaults. Later I would like to retrieve the BOOL value from the NSUserDefaults, but obviously I get NSNumber instead of BOOL. My questions are? how to convert back from NSNumber to BOOL? How to compare NSNumber to BOOL value. Currently I have: if (someNSNumberVa...

Writing to plists located at resource folder in iPhone

Any one please answer me, how to write into the plist file which is located in my resource folder. Please write an example code for me. ...

[CFArray release]: message sent to deallocated instance

Hi, I'm using the following method in my code: - (NSMutableArray *) newOrderedArray:(NSMutableArray *)array ByKey:(NSString *)key ascending:(BOOL)ascending { NSSortDescriptor *idDescriptor = [[NSSortDescriptor alloc] initWithKey:key ascending:ascending]; NSArray *sortDescriptors = [NSArray arrayWithObject:idDescriptor]; N...

Types of PNG image in iPhone app

I have an iPhone app that picks images from my internet server. It picks images with png extension but only PNG-24 is workings. The problem is that PNG-24 need some disk space and internet bandwith in iphone. I tried using PNG-8 but the iphone does not recognize it. Someone knows if I have a way to use PNG-8 into my app? Thanks! ...

cocoa - I've discovered what I think is a bug with NSDecimalNumber ...

Here is a simple code that shows what I think is a bug when dealing with double numbers... double wtf = 36.76662445068359375000; id xxx = [NSDecimalNumber numberWithDouble: wtf]; NSString *myBug = [xxx stringValue]; NSLog(@"%.20f", wtf); NSLog(@"%@", myBug); NSLog(@"-------\n"); the terminal will show two different numbers 36.7666244...

Not receiving touchesEnded/Moved/Cancelled after adding subView

Title more or less says it all. In response to a touchesBegan event, my UIViewController recolours itself and adds some subviews. It never receives the touchesEnded. I guess because the added subviews are somehow intercepting the event. I tried calling resignFirstResponder on the subviews to no avail. The code works fine when I don...

How do I change the frame position for a custom MKAnnotationView?

I am trying to make a custom annotation view by subclassing MKAnnotationView and overriding the drawRect method. I want the view to be drawn offset from the annotation's position, somewhat like MKPinAnnotationView does it, so that the point of the pin is at the specified coordinates, rather than the middle of the pin. So I set the frame ...

Reason why UIImageView gives me a 'distorted' image sometimes

I have a custom UIView with a UILabel and a UIImageView subview. (tried using UIImageView subclass aswell). I assign an image to it and add the view to the screen. I wrote a function which adds the amount of LetterBoxes to the screen as there are letters in the word: - (void)drawBoxesForWord:(NSString *)word { if(boxesContainer == nil) ...

iPhone App doesn't pick up Touch events, after replacing one view with another

Hi, Any idea why after replacing one UIView with another (with the same Touch event logic), the 2nd one won't pick up any touch events? I'm replacing them using: [currentView removeFromSuperview]; NewView *newView = [[NewView alloc] init]; [window addSubview:newView]; Thank you all for your help :) ...