objective-c

What is the screensize of a UIModalPresentationFullScreen

I have a UIModalPresentationFullScreen but my UI elements are not showing up properly. I want to define the screensize in IB, but I'm not sure what the size should be? ...

hiding network activity indicator

- (void)viewWillAppear:(BOOL)animated { app = [UIApplication sharedApplication]; app.networkActivityIndicatorVisible = YES; NSURL *url = [NSURL URLWithString:@"http://www.google.com"]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; [webView loadRequest:request]; } -(void)webViewDidFinishLoad { app.networkA...

GH-Unit for unit testing Objective-C code, why am I getting linking errors?

Hi there, I'm trying to dive into the quite frankly terrible world of unit testing using Xcode (such a convoluted process it seems.) Basically I have this test class, attempting to test my Show.h class #import <GHUnit/GHUnit.h> #import "Show.h" @interface ShowTest : GHTestCase { } @end @implementation ShowTest - (void)testShowCreate {...

iPhone, Convenience Method or Alloc / Release?

Whilst developing for the iPhone I had a stubborn memory leak that I eventually tracked down to NSXMLParser. However whilst looking for that it got me thinking about maybe changing a lot of my convenience methods to alloc/release. Is there any good reason for doing that? In a large app I can see how releasing memory yourself quickly is a...

Why am I allowed to write and use methods in an implementation that aren't declared in the header file in Objective-C?

@interface SomeClass : NSObject { } @end @implementation SomeClass -(void) awesomeMethod600 { } @end No error, and awesomeMethod600 works. ...

Inserting image in a scrollview

How can I insert an image in a scroll view, so that I can zoom it. I am new to objective c. Any help will be greatly appreciated! ...

Obj-C memory management: why doesn't this work?

Why doesn't the following code work? MyViewController *viewController = [[MyViewController alloc] init]; [myWindow addSubview:viewController.view]; [viewController release]; As I understand, myWindow should be retaining viewController.view for as long as the window needs it. So why does this cause my app to crash on launch? (commentin...

iphone scanning a dat file for data

I am trying to remake a program I have made in C# in OBJ-C.In C# I used streamreader to search the data file for the line I am looking for then convert that line into a string that I can work with. I have looked at NSScanner but I'm not sure if thats quite waht I'm looking for but I'm by no means a cocoa expert. All I would like to b...

Using Three20's TTThumbsViewController in conjunction with TabBarController

I've been struggling to get TTThumbsViewController to work with my application's tab bar and navigation. Bit-by-bt, I've solved most of the problems. The first problem is what I see when I get to what is supposed to be a full-screen image view. It is creating a white block where the status bar used to be. See screen-shots... Any...

Time Zone offset number in Objective-c?

How can I get the Timezone offset in Objective-C (for iPhone OS 3)? Example GMT -5 is US Eastern Time... I want the -5. ...

How to check image during animation

I have set up an animation in the following way (self is an UIImageView, myImages an Array of UIImages): self.animationImages = myImages; self.animationDuration = 50; self.animationRepeatCount = 0; [self startAnimating]; During the animation I'd like to check the current image. I tried it the following way if([self image]==[UIImage i...

Difference between "+" and "-" before function name in Objective-C

Hello Everyone, What is the difference between "+" and "-" before the function name interface declaration in an Objective-C program. Example: - (void)continueSpeaking; + (NSArray *)availableVoices; What's the difference? ...

Is it possible to use a Segmented Control to change the view?

i want to use a segmented control instead of a UITabBar controller to change the view. Is that in accordance with the HIG? If yes, how can I do so? What template should I use for my project and what code? ...

iPhone, confusing memory leak.

Can anyone tell me what I am doing wrong with the bottom section of code. I was sure it was fine but "Leaks" says it is leaking, which quickly changing it to the top version stops, just not sure as to why? // Leaks says this is OK if([elementName isEqualToString:@"rotData-requested"]) { int myInt = [[self elementValue] intValue]; ...

I don't understand how to use delegates in Cocoa but I know what they are.

Like many people I'm interested on Objective - C and Cocoa programming. I know conceptually what a delegate it is but I don't understand how to use them or when to use them. Here is some example code: #import "AppControler.h" @implementation AppControler -(id)init { [super init]; NSLog(@"init"); speechSynth = [[NSSpeechS...

Problems removing a " from a string

Hi, I have a string that ends with a " (quotation mark) that I want to get rid of. However, because XCode usually requires you to enter the text you wish to remove using stringByReplacingOccurrencesOfString in @"texttoremove" format, you can't use the quotation marks in the space as it thinks you are closing the text. Update: Now I can...

iPad title bars. Navbars or toolbars?

I see a bunch of apps for iPad with really cool title bars. These seem to be a combination of a navigation bar and a toolbar. They usually have a back button and a title as well as men other buttons. And a navbar only supports a left item, a right item and and title view. And the toolbar does not really support back buttons or titles. ...

How do I determine which control fired an event?

I have the Value Changed event of two UISliders (both of which have referencing outlets) wired up to the following method: -(IBAction) sliderMoved:(id) sender {} How can I determine which slider was moved so that I can get its value and update the corresponding label? Or would it be simpler to have two separate events, one for each sl...

drawRect not being called in my subclass of UIImageView

I have subclassed UIImageView and tried to override drawRect so I could draw on top of the image using Quartz 2D. I know this is a dumb newbie question, but I'm not seeing what I did wrong. Here's the interface: #import <UIKit/UIKit.h> @interface UIImageViewCustom : UIImageView { } - (void)drawRect:(CGRect)rect; @end And the imple...

How to save data from multiple views of an iPhone app?

Hi Everyone. I'm making an app where I need to save the text in multiple views in the app when the app quits. I also need to be able to remove all of the data from just one of those views and when the app quits, it's possible not all of those views will have been created yet. After reading this post I thought perhaps it would be good ...