cocoa-touch

Draw triangular UIButton on iPhone?

What would be the way to draw a triangular button on the iPhone. It would be nice if I could also change its parameters (backgroundcolor, font etc..) as with the regular buttons. Ideally I would like equilateral triangles. ...

How To Tell If an iPhone is in Sandbox Mode?

I have an iPhone application that has In App Purchases, and my application also pings my server whenever there is a successful or a failed IAP transaction, but I don't want to count IAPs that I make on my own test devices. How can I tell within the program whether or not I am in a sandboxed user account? ...

How to synthesize members from another class

I have created a certain class to represent an object. My program has several views and view controllers. I want the different view controllers to work with this object. However, when I try to synthesize the class members so that they can be used in the view controller, I get an error saying that there is no declaration of the property f...

table reloadData not called

I have a viewcontroller which contains a tableview. I call another view via pushViewController. When I get back to my original viewController I hope to redraw the table, but viewWillAppear is never called. Any other ideas? ...

how to access an object from another function

In viewDidLoad, an object is created. In some other function, I want to do something with the object, but outside of viewDidLoad, the object is not recognized. How can I access the object from other functions? ...

How to store and retrieve a custom class

NSUserDefaults won't accept custom classes. So how can these objects be stored and retrieved? ...

Need a solution to convert and store date/time in correct local time compared to device timezone

Hi Ok, I am not sure how to ask this question so that it can be understood... I need to store some schedules on a server (Ruby on Rails) from a iPhone. On the iPhone device the time is relative to the device timezone settings, but on the server I need to store the data in the servers local timezone correctly so that the scheduled event...

iPad view in incorrect orientation after dismissMoviePlayerViewControllerAnimated

My iPad app displays a movie full screen using the convenient MPMoviePlayerViewController class. I present it like this: [self.hostController presentMoviePlayerViewControllerAnimated:playerViewController]; And later, when notified that playing is done, I dismiss it like this: [self.hostController dismissMoviePlayerViewControllerAni...

Cookies in UIWebView

I have a UIWebView, and I don't want it to store an cookies, so just before the webview is loaded I do: NSArray* cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies]; for (NSHTTPCookie *cookie in cookies) { [[NSHTTPCookieStorage sharedHTTPCookieStorage] deleteCookie:cookie]; } Checking the count of cookies is 0 so the...

Issue with table header on a grouped style UITableView

I have a UITableView with a custom table header. This header was created by draggging a UITableViewCell object into the header section of a UITableView in IB. I then proceeded to set a background image using the backgroundImage property on this cell. I also set the table view to be of the 'grouped' style. The issue is, when it is displ...

Why is it that my UITableViewController setEditing:animated: method is not called?

I must be doing stupid, but I can't see what: my UITableViewController subclass is never called when the edit button of my navigation is pressed. What could be causing that? My view hierarchy is loaded from a Nib file and put inside a popover. The [+] button is connected to the insertNewObject action of my UITableViewController subclas...

save and restore an array of custom objects

I have an NSArray of custom objects that I want to save and restore. Can this be done with NSUserDefaults? ...

ALAssetRepresentation fullResolutionImage's UIImageOrientation is wrong

Hi all, I'm trying to ALAssetLibrary to fetch pictures in Photos app, but recently I found a problem, when I get the CGImageRef from ALAssetRepresentation, the UIImageOrientation is wrong(rotated 90 degree), but when I get width and height from the CGImageRef, they're wrong either, now how could I get the right CGImageRef or use the CGIm...

How can I know upto which part in a NSString a UIlabel can contain?

I have two labels side by side in the ipad with each taking half the screen. I dont want to use the scrollview. I just want the left label to contain the exact amount of test it can and want the remaining to go to the right label. How can I get the length of the string that a fixed size UILabel can contain? ...

problem in adding second UIbutton in cameraOverlayView

problem in adding second UIbutton in cameraOverlayView ,here i am able to add the first button but not able to add second button with following code - (void)pickAndDecodeFromSource:(UIImagePickerControllerSourceType) sourceType { [self reset]; // Create the Image Picker if ([UIImagePickerController isSourceTypeAvailable:source...

Load tabbars dynamically from a plist file

Hi, I have a plist file with a dictionary of several names of tabbars (e.g. tabbar1, tabbar2, tabbar3). I want to loop over this dictionary and load the tabbars when the app starts. My problem is that the .h file does not contain the according objects (e.g. TabbarViewController1). So, is it possible to load tabbars/viewcontrollers at ...

Customising UITabBarItems in their controllers?

In previous applications I have customised my tabBarItems by overriding init (see below) - (id)init { self = [super init]; if(self) { UITabBarItem *tabBarItem = [self tabBarItem]; [tabBarItem setTitle:@"ONE"]; } return self; } After looking at the Xcode templates I am now thinking that I would be better...

UIWebView: open some links in Safari, some within the view

My app features content that (for text formatting reasons) is presented in an UIWebView. Within the content there are links, some of which should open their target in mobile Safari, while others should navigate within the content. So far, I've catched the link requests using a UIWebView delegate. In my implementation of -(BOOL)webView:...

how do I restrict UIButton title text from spilling over

Hi there, New to posting here but got many really useful bits of help already. I am shoving some text into a UIButton title ( UIButton setTitle: forState: ) I want only the first bit of the text to be displayed (ie only amount that fits). Currently, I am getting extra text spilling over into the view. Is there any easy way to help st...

Why does using UITableViewCell from a unit test cause a Trace/BPT trap?

I have the following minimal test case in a minimal project created following the GHUnit README: #import <GHUnitIOS/GHUnitIOS.h> #import <UIKit/UIKit.h> @interface MyTest : GHTestCase { } @end @implementation MyTest - (BOOL)shouldRunOnMainThread { return YES; } - (void)testFoo { UITableViewCell *cell = [[UITableViewCell al...