我在做项目的时候遇到了objective-c中有这样的函数
- (NSString *)menu:(DOPDropDownMenu *)menu titleForRowAtIndexPath:(DOPIndexPath *)indexPath
{
}
然后我作了桥接,想用swift写这个函数,但是我不知道怎么转化,请大神告诉我上面的obc的意思与如何转化,谢谢
伊谢尔伦2017-04-24 09:14:51
func menu(menu:DOPDropDownMenu,titleForRowAtIndexPath indexPath:DOPIndexPath) -> NSString{
}
1. Whether to add private in front of func depends on whether you want it to be exposed to the outside world. 2. In Swift, String is generally used instead of NSString. The conversion between them can be done with as String and as NSString. 3. This writing method is It is written with reference to the tableview method. Inside the brackets are the parameters, -> followed by the return value type, as follows:
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return myCellArray.count
}