objective-c - obc与swift函数转化问题
阿神
阿神 2017-04-24 09:12:51
0
1
510

我在做项目的时候遇到了objective-c中有这样的函数
- (NSString *)menu:(DOPDropDownMenu *)menu titleForRowAtIndexPath:(DOPIndexPath *)indexPath
{


}
然后我作了桥接,想用swift写这个函数,但是我不知道怎么转化,请大神告诉我上面的obc的意思与如何转化,谢谢

阿神
阿神

闭关修行中......

reply all(1)
伊谢尔伦
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
    }
    
    
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template