objective-c

expected specific-qualifier-list before 'function' and expected '=', ',', ';', 'asm' or '__attribute__' before 'function'

Hello, I am programming in Objective-C but I would like to write a c function to increase the performance. I have written the code below this post but the compile keeps coming back with the following error: error: expected specific-qualifier-list before 'bool' error: expected '=', ',', ';', 'asm' or 'attribute' before 'addToBo...

Create a porthole animation transition on the iPhone?

Can anyone recommend how I might be able to create a view transition that looks like a circle expanding from the center of the view? Any pointers would be helpful, or maybe a link to some similar code, even in a different language. ...

handle touchesBegan method for UITextField in UIScrollView

Hello, I have a situation here, I have to handle touchesBegan for textfield. This textfield is in scrollview. I tried this so far: I made a subclass of UIScrollView @interface CustomScrollView : UIScrollView { } @end @implementation CustomScrollView -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { NSLog(@"good"...

Fading in one view for another

Here's my code: - (IBAction)showTaskDetailView:(id)sender { [window setContentView:viewTaskView]; } How would I fade out the current view and fade in the detail view? ...

EXC_BAD_ACCESS on very simple Objective-C program (Snow Leopard)

I'm following through one of the very early examples in Learning Objective-C on the Mac. My code is almost exactly the same as the code in the book (a couple spaces and trivial parentheses may differ). It looks like this: #import <Foundation/Foundation.h> BOOL areIntsDifferent (int thing1, int thing2) { if (thing1 == thing2) { ...

What Am I Missing? : iPhone Objective-C NSInputStream initWithData

I'm creating an NSInputStream from an NSData object but once created the stream reports NO for hasBytesAvailable: NSData* data = [outputStream propertyForKey: NSStreamDataWrittenToMemoryStreamKey]; NSLog(@"creating stream with data 0x%x length %d", [data bytes], [data length]); NSInputStream *insrm = [[NSInputStream alloc] initWithDat...

enum explanation needed

Hi everyone I have some doubt in enum in objectiveC understanding enum { kTagWord , kTagSprite , kTagSpriteManager , kTagSpriteError , }; let's say i have this enum, what does it mean? i really appreciate any helps ...

NSNotification problem for textfield and textview

Actually I have textfield in my sixth section of the tableview and a textview in the eleventh section of the textview.My problem is when I click on to the texfield of the sixth section the keyboard covers the text field and the same thing was happening with the textview.for that I used NSNotificationCenters. and I wrote the code as: -(v...

If else statment not work in my app

I´m making a dictionary (this is my test app) here is my code which not work: - (IBAction) btnClickMe_Clicked:(id)sender { NSString *kw = s.text; NSString *encodedkw = [kw stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSString *mms = [NSString stringWithFormat: @"%@", encodedkw]; if (mms=NULL){ ...

iPhone coding - compiler error - stray /342, stray/200, stary/223 ... why?

Hi, i'm trying to implement this code for accelerometer use but i'm getting a compiler error: stray /342, stray/200 ... for size,currentTouch, position object's and so on ... why? code: //GravityObj.h @interface GravityObj : UIView { CGPoint position; CGSize size; CGPoint velocity; NSTimer *objTimer; ...

Should I access Ivars directly within a class implementation?

I've been sort of on the fence on this one for a while, but I'd like to know what people think about accessing instance variables directly from within an Objective-C class implementation? Using accessors and mutators makes a lot of things easy, but for simple things, is it bad to access the instance variable directly? Is the best practi...

Marking instance variables @private

I've noticed that a lot of Apple's interfaces use @private before their instance variable declarations. Is there a good design reason for this, and is it something I should do? ...

Dock tile plug-ins for not running applications

Is the dock tile plug-in of an application used even when the application is not active? The documentation says that the dock title plug-in is used when the application is loaded in the dock, but that means that the application is running of that the application is put in the dock because the user wants it to stay on the dock? ...

Objective-C 2.0 properties: Why both retain and readonly?

I've noticed that some of Apple's examples include both a retain and readonly modifier on properties. What's the point of including retain if no setter gets generated when we're using the readonly modifier? Example: @property (retain, readonly) NSString *title; from the AnimatedTableView sample. ...

GData Google API Objective-C client help for iPhone

Hello. There seems to be no available documentation for the Objective-C client for the Google Data API. Google's API help webpage only has options for .NET, Java, Python, and the HTTP Protocol. I want to access data from a spreadsheet on my Google Docs account, and then add new data. I have added the correct source codes to my projec...

GDB dies because of NSZombieEnabled

I was having some problems with memory (exc-bad-access) in Objective-C, XCode, for iPhone, so I searched a little bit and found about the (awesome) NSZombieEnabled. Everyone outhere is just explaining how cool this is ... but it doesn't work for me :/ I followed the following 'tutorial': http://www.cocoadev.com/index.pl?DebuggingAutorel...

How to write a BOOL to plist?

I'd like to assign a boolean value to a plist file entry. I'm doing the following: NSString *aBool = realBoolValue ? @"YES" : @"NO"; [myplist setValue: aBool forKey:@"boolKey"]; [myplist writeToFile: [NSHomeDirectory() stringByAppendingPathComponent: plistFilePath] atomically:NO]; But the assignment never takes. I'm doing the ...

comparing BOOL against YES

I found today a comment in a source file: // - no longer compare BOOL against YES (dangerous!) So my question is: Is comparing BOOL against YES in Objective-C really that dangerous? And why is that? (Can the value of YES change during runtime? Like NO is always 0 but YES can be 1, 2 or 3 - depending on runtime, compiler, your linke...

Preview content of UIScrollView

I have a UIScrollView which displays a series of images (paging enabled). I would like to provide a way to preview the next and the last visible image in the scrollview. For example, if I have three images (A, B, and C) and image B is currently visible, then, on the right of image B I would like to see image C through some sort of semi...

Is it possible to include a quotation mark as part of an nsstring?

I have a label that displays inches. I would like to display the number with the inch symbol (") or quotation mark. Can I do this with an nsstring? Thanks! ...