objective-c

Drawing an "NSView" to a Custom-View - How? Am I taking the right approach?

I'm using Objective-C and Cocoa, whilst developing for Mac OS X - so not the iPhone/Cocoa Touch. (That said, I'd be interested if it was the same procedure for the iPhone) I'm working on a preferences window for a simple app. I have a NSWindow with a toolbar - there are 5 different items on the toolbar, all of which need to bring up a d...

Access objective-c from c++

Can somebody point me in the right direction for this. I've found lots of info on using c++ in obj c but not the other way around. I am making an iPhone game in c++ but need to tap into some of the features the iPhone has to offer. Thanks ...

Using NSXMLParser to extract attributes that are URL encoded?

Hello, I am trying to use NSXMLParser on the iPhone to parse a string that contains HTML, similar to the HTML shown below... <html><head><title>Working...</title></head><body><form method="POST" name="hiddenform" action="http://xxx/zfp"&gt;&lt;input type="hidden" name="wa" value="wsignin1.0" /><input type="hidden" name="wresult" value=...

How do I load a new view and start navigation from there?

I've been googling this for days, and I'm pulling my hair out trying to get this to work. In my app, the very first view that loads is a view that has a login and signup button. Pressing the login button calls - (IBAction)login:(UIButton *)sender { LoginViewController *loginView = [[LoginViewController alloc] initWithNibName:@"LoginVi...

how can i zoom a portion of my view based iphone app?

I am using iPhone SDK 3.2. I have drawn some lines on an UIView like road on a small city and added that as subview to the main view window(controller view). Now I need to zoom it from different point of view like a more specific aria of that city. FYI: I am a new programmer in Obj-C as well iPhone app development. ...

UIImageView with jpg has incorrect size

I'm at a loss with an UIImageView that I load into a scroll view. The original jpg Image has 1600 x 2000 pixels. In Interface builder I set the image frame to 1600 x 2000. When I run it and NSLog the image bounds I get a bounds size of 1603.565 x 1830.737 (?)!. The image also doesn't really reach down to the end, but takes an actual s...

iPhone: create new "View-based Application" = no view controller?

I have created a new iPhone "View-based Application" in Xcode. I then added a new "UIViewController subclass" and checked the "with XIB for user interface. Now the issue I have is that after hooking up all the variables and message handlers, I cannot push the new controller onto the stack using the following code: [self.navigationContro...

Objective-C performSelector does not call a method with parameter

Hi all, I'm having a problem with performSelector. It works if I call a method without parameters, but it doesn't even call the method if I pass a parameter. Example: - (void)test { NSLog(@"test"); //it works!! } ... [self performSelector:@selector(test) withObject:nil afterDelay:1.0]; - (void)switchOn:(NSNumber *) index { NSL...

Push NavigationController from UIScrollView

hi, how can I push a new view onto the stack of a NavigationController from a UIScrollView? I tried [self.navigationController pushViewController:myNewViewController animated:YES]; but get "navigationController not in structure or union". regards ...

GNU Objective-C runtime trickery

Can I, in the GNU Objective-C runtime, attach semi-arbitrary pieces of data to instance variables? Challenge: I'm currently working on a kind of Cocoa workalike for Linux, as a sort of pet project. (Please, let's not get sidetracked by all the "use GNUStep" stuff. I know about it, but it doesn't suit my needs. Moving on…) For this purp...

General C/Objective C Question

I was going through Apple's documentation & I saw something like this (void (^)(void)). Can somebody explain what this statement means. ^ is XOR right... void XOR void doesn't makes much sense to me ...? There was also something like (void (^)(BOOL finished)) ...

Parse XML Using NSXMLParser for display in table view

I am parsing some XML from an RSS feed (using NSXMLParser) for a blog and would like to display the data for each post in a table cell. The XML looks like this: <item> <title>Blog post 1</title> . . </item> <item> <title>Blog post 22</title> . . </item> How would I store this data so that it is available to my ...

How to remove a subView

I added a subview using myViewController *myVC = [[myViewController alloc] initWithNibName:@"myView" bundle:nil]; [self addSubview:myVC.view]; [myVC release]; how can I remove it again from a myViewController method ? I tried [self.view removeFromSuperview]; but that doesn't work ...

How to pass NSTimeInterval object to detachNewThreadSelector withObject parameter?

I'm still new to Objective C syntax, so I might be overcomplicating this, but I can't seem to figure out how to pass an NSTimeInterval to a thread. I want to initiate a thread that sleeps for x seconds parameter sent from main thread as follows: [NSThread detachNewThreadSelector:@selector(StartServerSynchThread) toTarget:self withObje...

NavigationController in Utility Application

I have create a project based on Utility Application. How to attach Navigation Controller on the FlipsideViewController? I want to create a lot of views with different screens. ...

Custom UIView throws a EXC_BAD_ACCESS on [super dealloc]

Hello. I'm developing an iPhone application. I have a class that inherits from UIView. It has a method to add two UILabels and one UIImageView as subviews of the class. The UILabels and UIImageView are created and destroyed on that method. When I release this custom class it fails on [super dealloc] call on its dealloc method. The de...

set UIButton's buttonType programmatically

I have a UIButton which I've added in IB, however the view behind this button changes color and I need to switch the button's type between InfoDark and InfoLight. Bizarrely though, buttonType property is read only. So how can i switch between light and dark info buttons? ...

UIPickerView Crashing App when wired up to Datasource / Delegate

Tearing my hair out trying to get the most simple of tutorials to run, from the book 'Head First iPhone Development' Have a UIPickerView which is bound to an array of objects. That is all. It doesn't do anything, all I want it to do (for now) is to display whats in the array. I've followed the steps in the book word for word, and restar...

addSubview to ScrollView - uncontrolled Button-action

I have a UIScrollView with an Image subView. I subclass touchesEnded to add a dialog box as a subView as follows: - (void) pushInfoBox { // the following line is referred to "myVC Caller" below myViewController *myVC = [[myViewController alloc] initWithNibName:@"myView" bundle:nil]; [self addSu...

Finding maximum numeric value in NSArray

I have an NSArray of NSNumbers and want to find the maximum value in the array. Is there any built in functionality for doing so? I am using iOS4 GM if that makes any difference. ...