objective-c

Replace UIBarButtonItem with UIActivityIndicatorView

Hi I want to replace my UIBarButtonItem (used for refresh) with a UIActivityIndicatorView and, when the refresh is finished, I want to turn back to the refresh button and remove the UIActivityIndicatorView. Can anyone help me? Thanks ...

iPhone: Button "Vote in AppStore"

I would like to add a button "Vote Us" that opens App Store and brings automatically users to my app review page where they can vote my app. How can I do it? ...

iPhone/iTouch information in a Cocoa App?

How would you retrieve the iPhone/iPod Touch information in a cocoa app, (not an app for the devices), ie such as what iTunes does to show the information of your connected device? Thanx! ...

Objective-C Socket Streams "Bad File Descriptor" (IPhone)

I'm trying to create a simple IRC client, purely for fun and to try and learn a bit more about socket programming in objective C. So I've looked at some sample code and I have no idea why I can't seem to send or receive message upon connecting. Firstly I connect to the server using the following code: if (![urlString isEqualToString:...

What is the difference between (+) and (-) operator in obj c function

Hi i am new to iphone and starts to learning Obj c. i have notice the function definition, for some function we are using (-) and for some function we are using (+) Example: + (id)requestWithURL:(NSURL *)theURL – initWithURL: what the difference between those two operator / symbol's usage? thanks! ...

Toolbar and Textfield problem

Hello guys! I have an iPad project. In the project I have a toolbar and then I add a textfield on it. Here's my simplified code. - (void)viewDidLoad { [super viewDidLoad]; UITextField *pageNumbersView = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, 100, 40)]; pageNumbersView.clearsOnBeginEditing = YES; pageNumbersView.bor...

classes in obj.c

@interface MainViewController : UIViewController < FlipsideViewControllerDelegate >{ } I am quite new to object oriented languages & especially obj.c. I need to use addressbook framework within this class.Apple documentation suggests this code: @interface ViewController : UIViewController < ABPeoplePickerNavigationController...

what is the problem if program is crash, when click save button?

hi experts, I have a simple todo list embedded in my main app, I had established it in a separate project, then I add it to my main project carefully, everything is good but, when I write the todo and click save button the program is crash! what is the problem? my code: self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc...

How to have CATiledLayer not block the main thread

I am implementing a CATiledLayer into a UIScrollView. In the CATiledLayer, I have a function to draw the layers like so: - (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx { CGContextTranslateCTM(ctx, 0.0f, 0.0f); CGContextScaleCTM(ctx, 1.0f, -1.0f); CGRect box = CGContextGetClipBoundingBox(ctx); NSData *d...

error “EXC_BAD_ACCESS” in my programm

Hi, i have a problem. When i compile my program there isn't a error but, when i start it these retern with “EXC_BAD_ACCESS”. I looking for the error with the debug and i find it in these method but i don't understand where... Can you help me? Thanks and sorry for the english. PS:the program enters in the loop sometimes. -(void)updateM...

Defining a Class in Objective C, XCode

Hello; I am new to Objective C, and am trying to write a class that defines a complex number. The code seems fine but when I print to the console, my values for instance variables are 0. Here is the code: // // ComplexNumber.h // Mandelbrot Set // // Created by Brett on 10-06-02. // Copyright 2010 __MyCompanyName__. All rights res...

UIImage Fade in after load on my UITable

I have an UIImage that loads from the web, and I'd like it to fade in when it displays in my UITableCell. if([thumb image]) { UIImage *imagen = [thumb.image retain]; [imagen drawInRect:CGRectMake(15, 4, 44, 44)]; [imagen release]; } How could I achieve it? ...

Using NSPredicate to determine if a string equals another string.

I have a NSArray of CalEvents returned with the [CalCalendarStore eventPredicateWithStartDate] method. From the events returned, I am trying to keep only those in which the title of the event == @"on call" (case-insensitive). I am able to keep in the array those events whose title includes @"on call" with the following code (where event...

subview take touch event on all window

Hello, i have a little problem on my view. I have a uiviewControler, load a xib. on this view i have a UIButton ( on touch it's work fine) I add a subview create by code (on a different class ) this view respond to her touch event. when i add this subview on my view, the event on this view are ok, but the UIButton on my first uiview n...

Open iBooks from an iPad application

I'm creating an application for a client. The iPad will be pre-loaded with a ebook that we will be creating ourselves. This ebook will not be available in the bookstore, but will be preloaded via itunes. Is it possible to open the iBooks application from my application, via some URL schema? Is it then possible to link directly to our p...

Working with NSNumberFormatter

I have a question that I am looking for the answer to. I am not really understanding NSNumberFormatter. I've stared at the documentation for a while, and can't seem to understand why I can't get setMinimum (or setMaximum) to work at all. Here is the code I am using: NSNumberFormatter* numberFormatter = [[[NSNumberFormatter alloc] ini...

Obj-C: Creating an object with a String name

Hey all. I know this sounds simple, but I can't find a way to do it. I have a method in Obj-C that takes in a NSString and then should create a new class with the String as its title. -(DataModel *)createDataModel:(NSString *)dataModel_name { DataModel *[initWithString:dataModel_name] = [[DataModel alloc] init]; } I ...

Can't compile code when working with CALayer

For some reason I get linker errors when I try and use CALayer: "_OBJC_CLASS_$_CALayer", referenced from: I have imported the following headers: #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> #import <QuartzCore/QuartzCore.h> Code: arrowImage = [[CALayer alloc] init]; ...

NSDictionary: convert NSString keys to lowercase to search a string on them

Hello. I'm developing an iPhone application. I use a NSDictionary to store city's names as key, and population as value. I want to search the keys using lowercase. I've using this: NSDictionary *dict; [dict objectForKey:[[city stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] lowercaseString]]; But...

Generating objects for a grid of nodes in Obj-C

Hi there, For a program I am developing I have to create a grid of nodes. For instance a grid of 10x10 = 100 nodes. A node can contain several variables. I am having problems visualizing this in a Object Oriented way. My idea is that I let the program automatically create an object for every node, as I have made a class "Node". My quest...