How to indicate the word is method name in Objective-C?

You can indicate that XXX is method name by writing XXX().

But in Objective-C, you can not write XXX() for XXX method.

If you write XXX, you can’t tell if XXX is method name or other type of identifier.

How can you indicate that XXX is method name of Objective-C class?

EDIT

Method call of Objective-C is different from other language.

in Objective-C, method call is:

[self XXX];

in other language, method call is:

self->XXX();

In other language, for example, we can write in stackoverflow:

XXX() doesn't work

And we can know XXX is method thanks to ().

But in Objective-C, we can’t say:

XXX doesn't work

Instead, to make it clear that XXX is method, we have to say:

XXX method doesn't work

3

If you’re talking about using init in documentation or some other place where you’re describing the method, you can prefix it with a - if it’s an instance method or a + if it’s a class method. If the method takes parameters, leave them out and just concatenate the different parts of the method name, like: -initWithNibName:bundle: or +colorWithRed:green:blue:alpha:. Don’t leave the colons out, though — they’re part of the selector. For example, you might write:

One way to create a color is by calling UIColor’s +colorWithRed:green:blue:alpha: method.

Sometimes people include both the class name and method name, prefixed with the appropriate character and wrapped in square brackets:

One way to initialize a view controller is with -[UIViewController initWithNibName:bundle:].

That’s not really a correct use of Objective-C syntax — you’d never actually call a method like that — but it conveys three important pieces of information: type of method (class or instance), class, and selector.

In code, of course, you don’t need to do anything special to indicate what kind of identifier it is. Just use the method name in an appropriate context and the compiler will figure it out:

UIColor *color = [UIColor colorWithRed:0.5 green:0.5 blue:0.9 alpha:1.0];

NSMutableArray *array = [[NSMutableArray alloc] init];

0

I will typically use +[NSString stringWithString:] and -[NSString initWithString:], unless there is enough context to omit the + or - and class (then I would reduce it to stringWithString: and initWithString:).

Terminology: It’s not a method name, it’s a message name, aka selector.

To your question: it’s obvious from the syntax, message sends always take the form [receiver message_with_parameters], where receiver is an expression (it may be another [...]), so anything after receiver is a selector (that is, what you call method name). In case of selector without params, it is just its name (like is the case with [[Class alloc] init], in case of of selector with params, it looks like [3 between: 1 and: 5].

Or is your problem somewhere else? The question was a bit unclear.

2

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật