Truemag

  • Categories
    • Tips And Tricks
    • Internet
    • PHP
    • Javascript
    • CSharp
    • SQL Server
    • Linux
  • Lastest Videos
  • Our Demos
  • About
  • Contact
  • Home
  • Write With Us
  • Job Request
Home iPhone XCode Xcode static function/method

Xcode static function/method

If you are wondering how to declare a function/method in XCode when develop iPhone apps, you will need to declare a class level method in Objective-C by using “+” before the method declaration.

For example, you wanna create a static method called saySomething() in a common.h class and then implement the function in .m file.

common.h

[text]

#import <Foundation/Foundation.h>

@interface common : NSObject {

}

+ (void) saySomething;
@end
[/text]

common.m

[text] #import "common.h"

@implementation common

+ (void) saySomething{
NSLog(@"Hello iPhone application!");
}

@end
[/text]

That’s all, you can call it from anywhere.

Note: a “-“ before method declaration means instance methods and “+” means class level method which are not related with any particular instance of the class.

Mar 2, 2011Hoan Huynh
PHP open source google analytics competitorPowerShell Piwik - File cannot be loaded because the execution of scripts is disabled on this system
You Might Also Like:
  • Facebook Like Button And Recommend Button With fb:like, iframe and html5
  • How To Track Website With Multiple Google Analytisc Accounts
  • JavaScript Get Radio Button Value
  • Get Image Width Height With JQuery And JavaScript
  • Jquery checkbox checked
  • Javascript LTrim,RTrim,Trim function
  • Javascript Problem Set focus textbox on Firefox
  • MSSQL Trim Function
  • Create Count Down Download Page With JavaScript
  • Facebook Publish To Wall With External Link And Track Callback
Hoan Huynh

Hoan Huynh is the founder and head of 4rapiddev.com. Reach him at [email protected]

10 years ago iPhone XCodeclass level method, NSObject527
0
GooglePlus
0
Facebook
0
Twitter
0
Digg
0
Delicious
0
Stumbleupon
0
Linkedin
0
Pinterest
Most Viewed
PHP Download Image Or File From URL
22,237 views
Notepad Plus Plus Compare Plugin
How To Install Compare Text Plugin In Notepad Plus Plus
20,087 views
Microsoft SQL Server 2008 Attach Remove Log
Delete, Shrink, Eliminate Transaction Log .LDF File
15,872 views
JQuery Allow only numeric characters or only alphabet characters in textbox
13,343 views
C# Read Json From URL And Parse/Deserialize Json
9,850 views
4 Rapid Development is a central page that is targeted at newbie and professional programmers, database administrators, system admin, web masters and bloggers.
Recent Posts
  • Term Papers – Easy to Take Care of
  • How to Write Term Papers in Online Tutorials
  • How to Plan Writing an Essay
  • How to Apply For a Payday Loan With Bad Credit
  • Statistics For Sale – How To Compose One
Categories
  • CSharp (45)
  • Facebook Graph API (19)
  • Google API (7)
  • Internet (87)
  • iPhone XCode (8)
  • Javascript (35)
  • Linux (28)
  • MySQL (16)
  • PHP (84)
  • Problem Issue Error (29)
  • Resources (32)
  • SQL Server (25)
  • Timeline (5)
  • Tips And Tricks (141)
  • Uncategorized (123)
Recommended
  • Custom Software Development Company
  • Online Useful Tools
  • Premium Themes
  • VPS
2014 © 4 Rapid Development