objective-c

why and where to use a delegate in objective c

i m a new iphone programmer i have created some small views without delegates.... if a program can run without a delegate then why and what is need of that yet i have seen some programs on net having delegates........ i m confused .......... please answer me waiting for your answer.............. ...

Objective C - NSArray and For loop structure

Hi everyone, Work got in the way of learning Objective C but i'm back at it now and this has been driving me crazy. This is my code: i=0; for (i=0;[photoList count]; i++) { NSLog(@"%i",i); NSLog(@"%@",[photoList objectAtIndex:i]); NSString *fileName = [photoList objectAtIndex:i]; sendImage = [UIImag...

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...

How to parse html string in iphone

Hi all, i m using this code for posting and getting the data from the server. NSString *post =[NSString stringWithFormat:@"any-data=%@", myData]; NSData *postData = [post dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES]; NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]]; NSMutableURLRequest ...

CoreData: Loading in an Initial Data Set from XML.

I have a plain XCode CoreData enabled iPhone/iPad navigation application. In this I have modifed the data it initially defines to represent some categories in the table view with associated images. For example by modifying a Event to Category elsewhere, changing the .xcdatamodel file and altering this call in RootController.m: - (void...

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...

Is it possible how to use self.navigationitem property in static method in iphone?

In my application which have a lot of viewcontroller classes as well as tableviewcontroller classes in all classes i want to show navigationcontroller which have //creation of toolbar UIToolbar *tool = [UIToolbar new]; tool.frame = CGRectMake(0, 0, 320, 42); //create setting button UIButton *bttn=[[UIButton alloc]initWithFrame:CGRectMak...

Problem with thread and initialization

Hi, I have a problem with my code. I lunch the thread and this thread have a NSTimer. I must remember a variabile location but when i repeat the method i reinitialize these and i lose the progress. Can you help me? Thanks My code:(these isn't my very code but is the same situation. I want remeber the number of the i but when restart the...

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...

Code reuse when parsing XML using NSXMLParser (iPhone dev)

In an iphone application that I am building, I am parsing XML in a number of view controllers when they are loaded by a user. Every time I do this, I am doing the following: establishing an NSURLConnection (in viewDidLoad) storing the data retrieved and error handling (connection delegate methods) creating an NSXMLParser parsing the ...

Need help with UIPasteBoard

Hi, I have an action that copies a string. I would like to paste this copied string out of my app. I want to access the copied data via other apps. How can I do that? ...

connect GUI to LOGiC

I am trying to build my first iphone app. first i finish with my app logic whitch contain DataLogic class that have all my arrays. and another 2 classes then i build my appGUI that contain 2 views. SearchViewClass and ResultViewClass now my problem is how to connect to logic to the GUI. the instance of DataLogic is on my AppDelegate cl...

NSURL Error Handling

Hi everyone, my app is supposed to make a request from a server every 10 seconds or so with a specific url, change some attributes in the url, and then show the request in another view called "updateView" or if any network error occurred display the error. The first part works fine but if i switch of wifi for example the app crashes. How...

Decoding integer and other masks in Cocoa

Cocoa has a plethora of integer masks and codes. For instance, NSCommandKeyMask or NSF1FunctionKey, which are clearly defined and documented in the headers. However, some can be archaic and when accessing accessibility attributes, for instance to get the glyph (AXMenuItemCmdGlyph), you're given an integer number like 111, which represen...

Anti-aliasing while animating "transform" property on CALayer?

I have a CALayer with a circle drawn to it at its final size. I want to animate the circle in, such that it starts at 1% scale and finishes at 100%. Right now the animation is not very smooth because the edges flicker while it's scaling. At the final size the circle looks right. I'm wondering if there's a way to have anti-aliasing during...

In Objective-C, how do you set up properties of properties, i.e. of a class set up as another class property?

I have been trying to set up an instance property of a class which is itself a class that contains instance variables. I would like to access these as properties. In C#, this is easy to do with the pre-set get and set variables: public class TheOverallClass { private ClassName _propertyName; public ClassName PropertyName { ...

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...

Is there any way to serialize / unserialize an Objective-C block?

I'm writing an app where support for "promotions" is required, and these promotions could be arbitrarily complex and many different pieces of data might be relevant in their calculation. Therefore, whilst in the early stages of development, I don't want to invent a whole specification schema for these things, I'd rather just write each ...

objective c arrays of floats and booleans possible?

NSArray chemConstantArray = [[NSArray alloc] initWithObjects:0.0021400, 0.0012840, 0.0010700, nil]; Gives me four errors: Incompatible type for argument 1 of 'initWithObjects:' Invalid initializer Statically allocated instance of Objective-C class 'NSArray' x 2 Which makes sense, as floats are not objects, but how can I make an arr...