11.2 可変メニューにする
じつは可変メニューを実現するには「すべてのメニューをプログラム的に作り直す」という方法しかありません。このために用意されているのがWKInterface ControllerのclearAllMenuItemsとaddMenuItemWithItemIcon系のメソッドです。
- (void)refreshMenu {
[self clearAllMenuItems];
NSString *mapFixTitle = (isMapFix==YES?@"地図移動":@"地図固定");
NSString *markerFixTitle =
(isMarkerFix==YES?@"マーカー移動":@"マーカー固定");
[self addMenuItemWithItemIcon:WKMenuItemIconPause
title:mapFixTitle action:@
selector(fixMap)];
[self addMenuItemWithItemIcon:WKMenuItemIconBlock
title:markerFixTitle action:@
selector(fixMarker)];
[self addMenuItemWithItemIcon:WKMenuItemIconDecline
title:@"戻る" actio
この記事は会員限定です。会員登録をすると続きをお読みいただけます。
ログイン / 新規登録