function SimpleSymbols(str) {
var letter =['a','b','c','d','e','f','g','h','i','j',
'k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'];
var newstr = "";
for (var i = 0; i<str.length; i++){
if (str.charAt(i).toLowerCase() in letter){
newstr += "M";
}
else{
newstr += "X";
}
}
return newstr;
}
Run Code Online (Sandbox Code Playgroud)
如果str是"Argument goes here",则返回XXXXXXXXX.为什么不返回MMMMMMMMMM?
IDE:Xcode10
操作系统:10.13.6
编译错误
显示最近的消息构建系统信息错误:无法找到sdk'iphoneos11.2'(在目标'xxx'中)
该项目建立在Xcode 9.4/OS 10.13.4之上.只有在更新后,项目构建才开始失败.
我正在调用此方法,并且nextCellIndexPath是一个大于当前单元格的indexPath,但是indexPath没有适当地递增。
这是cellForItemAtIndexPath:
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCellWithReuseIdentifier("collectionViewCell", forIndexPath: indexPath) as! ImageCollectionViewCell
cell.nextCellIndexPath = indexPath.indexPathByAddingIndex(1)
return cell
}
Run Code Online (Sandbox Code Playgroud)
当我尝试滚动到下一个indexPath时,似乎indexPath不会增加。
那么,如何正确获取下一个indexPath?