-1

([MyArray ObjectAtIndex:myindexpath.row])例外をスローせずにこれを実行できるように、ある種の catch ステートメントを記述する方法はありますか?

つまり、次のような式を書きたいと思います。

if ([MyArray ObjectAtIndex:myindexpath.row]) {

// do some stuff if the object is in the array

else {

// do some other stuff

}
4

1 に答える 1

2

確かに:論理と数学を使用してください。

if (index < myArray.count) {
    // ...
}
于 2013-07-18T05:57:11.313 に答える