objective-c

Changing image on UIButton when user presses that button on an iPhone

Hello, I want to change the image on UIButton, when User presses that button. So, I have write btnthumbnail2 setImage:[UIImage imageNamed:@"leaderboard_ov.png"] forState:UIControlStateNormal]; and after that I change the view. The image is changing but not display the changed image.I think the controll goes to next view tha's why it ...

Why is Xcode Giving Me These Errors?

The error I get is Xcode saying 3 things are un-declared (see below picture) But in the Header File I have declared them (see below picture) Why I am getting these errors when I have declared them. The Full Code: Header File. #import <Foundation/Foundation.h> @interface HotKeyController : NSObject { IBOutlet NSButton *cmdHK...

hiding the animating image which shows the image capture action in iPhone

I want to hide the default image in iPhone which shows the image Capture process. I created an object of UIImagePickerController, and wrote the methods for saving the image into photo library. When I press the capture button the default animated image comes, which shows the saving process. How I hide that animated image ? Is there a...

How to Check if an NSDate occurs between two other NSDates

I am trying to figure out whether or not the current date falls within a date range using NSDate. For example, you can get the current date/time using NSDate: NSDate rightNow = [NSDate date]; I would then like to use that date to check if it is in the range of 9AM - 5PM. ...

How do I read and write XML in Cocoa Touch?

I want to create a file using Objective-C, which stores the data comes from XML. I also have to do basic functions of read and write into that file. How can I do this? ...

How to change iphone CATiledLayer fadeDuration ?

Hi StackOverflowers I am working on an iphone application that displays tiled maps. I am currently using a CATiledLayer in a UIScrollView : MyTiledDelegate *delegate=[[MyTiledDelegate alloc] initWithMapLayer:map]; tileLayer = [CATiledLayer layer]; tileLayer.delegate = delegate; [scrollView.layer addSublayer:tileLaye...

how to remove first 3 characters from nsstring?

i have a string like this A. rahul VyAs and i want to remove A. and the Space After The A. so that new string would be rahul VyAs how do i achieve this? ...

Is it possible to disable floating headers in UITableView with UITableViewStylePlain?

Hi, I'm using a UITableView to layout content 'pages'. I'm using the headers of the table view to layout certain images etc. and I'd prefer it if they didn't float but stayed static as they do when the style is set to UITableViewStyleGrouped. Other then using UITableViewStyleGrouped, is there a way to do this? I'd like to avoid using gr...

what does sending a message to nil mean, and why is it a special case?

I just started reading the Objective-c tutorials, and there is a section on sending a message to nil. What does this mean? I can't seem to follow it. ...

Passing a ManagedObjectContext to a second view

I'm writing my first iPhone/Cocoa app. It has two table views inside a navigation view. When you touch a row in the first table view, you are taken to the second table view. I would like the second view to display records from the CoreData entities related to the row you touched in the first view. I have the CoreData data showing up fin...

Cocoa Touch Question. Using KVO in a touch sequence context

I would like to use KVO in the following context: 1) In touchesBegan:withEvent: I alloc/init an instance of an object that I then observe via KVO My intent is to observe varous behaviors of the object throughout its life time. 2) In touchesEnded:withEvent: I assign this instance to an NSMutableArray and release the instance reference ...

Comparing two xml files in Objective-C

Hi there! I have two xml files (a.xml and b.xml) in my file system (iPhone). Now I want to know if these files contain exactly the same data. Most of the time, this comparison would be true, because b.xml is the result of a copyItemAtPath: operation. Unless it is overwritten by newer information. What would be the most efficient way to ...

UIApplication sharedApplication tel: add numbers to the current call (objective-c)

With iPhone you can dial a number and you can add some other persons to the call using the iPhone-panel (manually). I want to do it automatically. I can dial a number from my native iPhone-Application with: [UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:...."] The native "call" get started and when I finish it,...

shouldStartLoadWithRequest is not called in my iPhone App

I have a view controller with a UIWebView controller. I'm trying to get the javascript inside the html content of the web view to pass some information to my objective c code. I came across a number of examples online that set window.location in a javascript function and then catch the event generated by setting the view controller to be...

How do I observe the creation/destruction of an object instance?

I am smitten by KVC/KVO. Super powerful. There is one problem though. I'm trying to be true the the MVC etho but I see no way to use an observation pattern to monitor the allocation or deallocation of an Objective-C class instance. This is actually important as I have a model with fine-grained internal messaging that I want to observe f...

How do you wrap up a BOOL for KVC in Cocoa/Obj-C?

I'm using KVC to iterating through a few views. Having trouble setting BOOL properties: [self setValue:YES forKeyPath:[NSString stringWithFormat:@"myView%d.userInteractionEnabled", n]]; I get: warning: passing argument 1 of 'setValue:forKeyPath:' makes pointer from integer without a cast. There is no [NSValue valueWithBool:YES] or si...

Objective-C not recognizing .h?

I have the following in a project named testApp: (testAppViewController is the valid name of my view controller in the project) PrevView.h #import <UIKit/UIKit.h> #import "testAppViewController.h" @interface PrevView : UIView { testAppViewController *viewController; } @property (nonatomic,retain) testAppViewController *viewContro...

How to convert betwee number of minutes to hh:mm format in obj-c?

How to convert betwee number of minutes to hh:mm format in obj-c? For example, 65 minutes = 01:05 ? ...

IPhone Connectivity Testing: How do I force it to lose connection?

Apple wants me to give the user a friendly apology if I can't find an internet connection. Using the Reachability Demo, this was easy enough. I want to take it a step further and monitor for a connection loss. The demo has this functionality, but I can't figure out how to shut my connection off to test if it works. How would I go about ...

OCUnit test for protocols/callbacks/delegate in Objective-C

Using OCUnit, is there a way to test delegate protocols? I'm trying this, which doesn't work. -(void) testSomeObjDelegate { SomeObj obj = [[SomeObj alloc] initWithDelegate:self]; [obj executeMethod]; } -(void) someObjDelegateMethod { //test something here } I'm going to try calling the obj method on a different thread and have ...