これを回避する方法があることは知っていますが、次の質問が可能かどうか知りたいです。Objective-C でメソッドを「中止」できますか? この場合はココアタッチです。IBAction があります。そのアクションでは、if/else if/else ステートメントを使用しています。そうでない場合は、残りのメソッドを中止したいと思います。return 0 に似ていますが、IBAction 用です。
これは可能ですか?もしそうなら、どのようにこれを達成しますか。メソッド全体はちょっと長いですが、ここに私が見ている部分があります:
if ([unitType isEqualToString:@"mg/dl"])
{
//Unit is mg.
typeOfUnit = unitType;
}
else if ([unitType isEqualToString:@"mmol"])
{
//Unit is mmol
typeOfUnit = unitType;
}
else
{
//Apparently either a bug or a (null) item.
typeOfUnit = @"mg/dl";
[[LEItemStore sharedStore] createItem];
item = [[[LEItemStore sharedStore] allItems] objectAtIndex:0];
[self loadItems:self];
//Code to Abort the rest of the method here.
}
ありがとう。