cocoa-touch

Cocoa Touch - Adding a UIImageView programmatically?

How can I create and position a new imageview in objective-c? Thanks! I tried this but it doesnt seem to do anything... -(void)drawStars{ //uses random numbers to display a star on screen //create random position int xCoordinate = arc4random() % 10; int yCoordinate = arc4random() % 10; UIImageView *starImgView = [[UII...

Timezone/DST agnostic timestamps with NSDate

I'm creating objects which will be sent to a server, and I'm trying to ensure I account for timezone and Daylight Savings issues, so I want my timestamps to be "seconds since 1970" regardless of timezone, etc. Is [NSDate timeintervalSinceReferenceDate] sufficient for this? In the docs I know it says time since January 1 1970 00:00:00 GM...

What is the best way for a view added via presentModalViewController to communicate its dismissal with the class which invoked the call?

What is the best way for a view added via presentModalViewController to communicate its dismissal with the class which invoked the call? In one of my methods, I use presentModalViewController:animated: to popup a scoreboard where a player enters their name, then clicks OK. Everything is working fine with the scoreboard, but when I use d...

UIView being double-drawn in device, but not simulator

I have a view with buttons. This view sits in a tabbarcontroller. I have just gotten an issue which appears in the device, but not in simulator. If I switch to another tab and back again the view is redrawn and my buttons come out doubled. I know this because the borders are thicker and the buttons with variable text overwrite each other...

Dealing with drawRect multiple calls

I discovered that my drawRect is being called more than once. Unfortunately this had the unfortunate side-effect of double-drawing everything because all my subviews are drawn in drawRect (I'm s strict atheist w.r.t. Interface Builder). What is the best way to deal with a multiple calls to drawrect? A flag to check if it's being called ...

How to unselect a UITableViewCell when UITableView has scrolled?

How can I unselect a UITableViewCell when UITableView has scrolled? ...

Get UIDatePicker variable from another view

I'm sure I have something dumb wrong, but I'm trying to pass the data set in a UIDatePicker from one view to another (I'm using the Utility Template in Xcode). I've written out all of the pertinent code below. FlipsideViewController.h @interface FlipsideViewController : UIViewController { IBOutlet UIDatePicker *datePicker; } @...

Does using Quartz layers slow down UITableView scrolling performance?

I have a UIImageView that is being rounded on my custom drawn UITableViewCell: rect = CGRectMake(13, 10, 48, 48); avatar = [[UIImageView alloc] initWithFrame:rect]; [self.contentView addSubview: avatar]; CALayer * l = [avatar layer]; [l setMasksToBounds:YES]; [l setCornerRadius:9.0]; I ...

How can I split a UITableViewCell?

I would like to achieve a UITableViewCell to look like this image (following/tweets/etc): ...

UIWebView Safety / Privacy

Does UIWebView pass on referral information? If a user clicks a link to my server and my server immediately redirects the request to a second server. Will the second server see the referral page? What's the default behavior? If that information is pass to the second server, how can I prevent that? ...

Displaying what the Camera can see in a View.

How would I display what the Camera can see in a view as if you were using the Image Picker in Camera Mode? Is this possible, to access the camera directly? ...

Objective-C Classes

So I have a ViewController Class which is my first view, I then add a subview to it, pseudo code code below; ViewController2 *viewController2 = [[ViewController2 alloc] init]; [self addSubview:viewController2.view]; My question is, in ViewController1, I have a method that does an animation and removes the view. How can I call that me...

Iphone - Deafult implementation of numberOfSectionsInTableView

I'm creating a new subclass of UITableViewController, and with it the below default implementation. It doesn't compile , cause clearly there is no variable called "number of sections", what's going on here ? The error is : "expected expression before '<' token" #pragma mark - #pragma mark Table view data source - (NSInteger)numberOfSec...

UIView Perspective in landscape orientation

I'm trying to apply '3D perspective' to a UIView with a UIScrollView embedded inside. This will allow the user to scroll through a set of photos with a 3D effect. Trouble is, the code below works fine in portrait orientation... but when I rotate the view to the landscape orientation, the scrolling no longer works. I have tried to nest...

Memory increase from cellFromRowAtIndexPath in UITableView

I have a UITableView with a cellForRowAtIndexPath method that creates a UITextView, then adds it to a cell. No memory leaks were detected, but when running Instruments (Object Allocations), the Net memory is on a one-way trip to 18 MB, where it crashes. My app constantly adds and deletes cells in the tableView datasource, but because t...

Cocoa Touch - Touches In a UIImageView

How can I make it so the image goes away when it is touched. Here is my code to create the image. It is randomly displayed on screen so after you touch it, it disappears and a new image in a new place appears. -(void)drawStarsAndDetectTouches{ //uses random numbers to display a star on screen //create random position int xCoord...

Presenting view controller modally animates slowly

I have a view that I am presenting modally. For some reason it animates very slowly. [self.parentViewController.tabBarController presentModalViewController:browser animated:TRUE]; I'm not sure why? I have even tried: [self presentModalViewController:browser animated:TRUE]; UPDATE: The UITableViewController that is presenting it, is d...

Initialize a UIImageView object with a rectangle image which will be created by programming.

Hi, I want to create a UIImageView object and initialize it with a rectangle image that will be created by programming and NOT from a pre-created bitmap file. Thanks in advance, Sagiftw ...

Show iphone soft keyboard even thought a hardware keyboard is connected

My iPad app uses an external "device" that acts as a hardware keyboard. But, at some point in the settings, I need to input text and I can't use the "device" ("device" is not a keyboard). So, is there any way to force pop the soft keyboard even thought I have a hardware keyboard connected? ...

New Images Can't Be Found in iPhone SDK

Hello, I've been trying to update an image that is packaged with my app, but the app refuses to load the new file. I originally had a png called "board.png". I then created a new file which is a higher resolution copy of the original. I deleted "board.png" from the Resources group in XCode and added the new image under the same name. W...