cocoa-touch

How do I programmatically provide a glossy look to UIButtons?

I would like to add 3D or glossy look to some iPhone UIButtons, but do so without the use of PNGs or stretchable images. I have a lot of buttons of varying shapes and sizes with lots of colors which are generated on the fly, so prerendered images are not feasible in my case. How would you go about drawing the gloss on these buttons pro...

Is it possible to have a repeating horizontal background image and a background colour for a UIView?

I'm developing an iPhone 4 app using iOS 4 SDK and am trying to add a small gradient image to a UIView object. I want to the background to repeat horizontally but not vertically. I then want the rest of the UIView to be filled with a background colour. Is this possible? ...

create empty NSDate object

Is this ok? NSDate *myDate; Because I used something like this before: NSDate *myDate = [[NSDate alloc] init]; if (something) myDate = thisDate; else myDate = thatDate; [myFunction initWithDate:myDate]; I always got "Value stored to 'myDate' during its initialization is never read". If I do something like this if (some...

How can I add multiple controls to a UITableView header section?

I have a UISearchDisplayController in the Header section of my UITableView. I would like to display an iAd right above that. How can I accomplish this? ...

How can I add a UISearchDisplayController to a UIView?

How can I add a UISearchDisplayController to a UIView? Interface builder won't let me. ...

iAd appears in simulator but not on device

When I run my application I can see my iAd in the simulator, that is pre-filled with "Test Advertisement" However, when I run the application on my device, the iAd area is blank, with no pre-filled ad. Why is this? My iAd is in a UITableViewCell: #import "iAdCell.h" @implementation iAdCell @synthesize adView; - (id)initWithStyle:(...

Is there a reverse "setValuesForKeysWithDictionary" - a makeDictionaryWithObjectProperties?

Hi I parse some JSON from a web service, this gives me an NSDictionary, I use this dictionary to populated properties on a valueEntity of type NSObject by [myObject setValuesForKeysWithDictionary:JSONDict]; (myObject has the same property names and types as the dictionary from the JSON parser) name = name count = count startDate = ...

how to restore view to view did load

i am using a view that displays multiple items depending on user input and i would like to when i press a button to be able to go back to the first view generated in the view (viewDidLoad). I tried numerius methods such as adding an action to a selector to load a -(void) that reloads the view however that crashes too. I havent been abl...

iAd: ADBannerViewDelegate methods only called once after viewDidLoad()

I have the following ADBannerViewDelegate implementations: #pragma mark ADBannerViewDelegate Methods - (void)bannerViewDidLoadAd:(ADBannerView *)banner { self.headerView.frame = CGRectMake(0, 0, 320, 94); [self.tableView setTableHeaderView:headerView]; adBannerView.hidden = FALSE; } - (void)bannerView:(ADBannerView *)banner...

Dictionary's and plist files

Hi all, I have written some code that pulls info from a plist file and does a couple of things then eventually pops this data into a table. This all works fine, the problem is I wrote the code pulling the data from a plist file within the resources folder, but the actual file will be created via an action and stored in memory. I need ...

App Crashes because iAd Fails to Resume in Time

My app runs fine when I don't have iAds. As soon as I display an iAd the system shuts down my app because the iAd can't resume in time. How do I resolve this? Elapsed total CPU time (seconds): 1.380 (user 0.880, system 0.500), 14% CPU Elapsed application CPU time (seconds): 0.000, 0% CPU Thread 0: 0 libSystem.B.dylib ...

drawRect function hindering performance

I am working on drawing a snake which moves using a CADisplayLink using DrawRect. The problem is when the snake is small the speed is fine, but when the snake grows in length the snake becomes really slow. I keep track of the snake using the followig variables: - variable to keep track of snakes head - variable to keep track of snakes ...

replaceSublayer example

I have the following code and I can't seem to get it to work. First I create a view with a layer. UIView *view = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 100)] autorelease]; CAGradientLayer *gradient = [CAGradientLayer layer]; gradient.frame = view.bounds; gradient.colors = [NSArray arrayWithObjects:(id)[[UIColor blackColor...

Dismiss keyboard when editing in UITableViewCell

I have a table full of custom UITableViewCells which have UITextFields in them. Although the user could use the return key to dismiss the keyboard, most of my keyboards are of the number pad type. Does anyone know of a way to detect when the user touches outside the UITableViewCell so I can programatically dismiss the keyboard? I would...

Find method signature for selectors in Objetive-C

Where can I find the method signature for callback methods in built-in classes like UIGestureRecognizer or UIMenuItem etc? e.g., documentation states for UIMenuItem: initWithTitle:action: Creates and returns a menu-item object initialized with the given title and action. -(id)initWithTitle:(NSString )title action:(SEL)action...

How can I animate my view resizing?

I am resizing my tables headerView. I want to animate it, but I am not sure how. -(void)layoutForBanner { // Depending on if the banner has been loaded, we adjust the content frame and banner location // to accomodate the ad being on or off screen. // This layout is for an ad at the bottom of the view. if(banner.bannerLo...

always returns false iphone obj c question

Hi everyone, I am trying to check a string to see if there are any misspelled words in it. I'm using apples UITextChecker class to do so like so: #import <UIKit/UITextChecker.h> id textChecker = [UITextChecker new]; NSInteger currentOffset = 0; NSRange currentRange = NSMakeRange(0, 0); NSRange stringR...

How can I run and test my own written program on my original iPhone after jailbreaking?

I have done jailbreaking. After jailbreaking I don't know how to install my helloworld program on my iPhone. Plz can anyone tell me the easiest way of installing / deploying my own program / app on my my iphone (hardware) step by step? Plz I m very much confused. plz .... ...

When to properly release an object

I am trying to better understand when to properly release an object in a fairly memory intensive program. My current doubt arises from the following bit of code: - (void)scrollViewDidScroll:(UIScrollView *)localScrollView { InteractionPointModel *model = [[InteractionPointModel alloc] init]; for (int x=0; x<totalInteractionPoi...

UITableViewCell accessoryType set, but accessoryView is nil. How do I set the accessoryView backgroundColor?

Here's how my cells are set up: - (UITableViewCell *)tableView:(UITableView *)tableViewIn cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"subcategory"; UITableViewCell *cell = [tableViewIn dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewC...