简体   繁体   English

Objective-C方法对应于这些JS方法?

[英]Objective-C methods that correspond to these JS methods?

NSMutableArray方法对应于这些Javascript Array方法?

  • shift();
  • unshift();
  • slice();
  • splice();
  • shift is a combination of -objectAtIndex:0 and removeObjectAtIndex:0 . shift-objectAtIndex:0removeObjectAtIndex:0
  • unshift is insertObject:obj atIndex:0 . unshiftinsertObject:obj atIndex:0 It does not return the new length, however. 但是,它不会返回新的长度。
  • slice is -[NSString substringWithRange:] slice-[NSString substringWithRange:]
  • splice has no equivalent, though you can approximate it with insertObjects:atIndexes: . splice没有等效,尽管你可以用insertObjects:atIndexes:近似它insertObjects:atIndexes: .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM