0

iOS5以降をターゲットにしたXcode4.5を使用しています。ユーザーが基になるビューのフォントを変更できるポップオーバーがあります。フォントをタップしても、ポップオーバーと下のビューを閉じて再度開くまで、変更は行われません。委任用に設定されています。そして、受信ビューはをインポートしFontsPopoverViewDelegateます。解決に向けての助けをいただければ幸いです。

フォントのデリゲートメソッド:

@protocol FontsPopoverViewDelegate <NSObject>
- (void)fontResize:(float)size forView:(int)type;
- (void)font:(int)fontID forView:(int)fView;
- (int)getFontForView:(int)fView;
- (float)getFontSizeForView:(int)fView;
@end

基になるビューに実装されたメソッド:

- (void)fontResize:(float)size forView:(int)type {
  fontSizes[type] = size;
  [self invalidate];
}

- (void)font:(int)fontID forView:(int)fView {
  fontIds[fView] = fontID;
  [self invalidate];
}

- (int)getFontForView:(int)fView {
  return fontIds[fView];
  [self invalidate];
}

- (float)getFontSizeForView:(int)fView {
  return fontSizes[fView];
  [self invalidate]; // added to spark a reaction from the view
}

-(void) invalidate {
  NSLog(@"Invalidate called");
  [self saveTextChanges];
  [self refreshBodyText];
  [self refreshBackground];
  [self refreshBodyText];
  [self refreshDateFont];
  [self refreshTitleFont];
}

どんな助けでも大歓迎です。

4

1 に答える 1

0

フォントポップオーバーから基になるビューに通知を投稿することで、これを解決しました。基になるビューで、呼び出しを追加しました... [self viewWillAppear:YES];

今、それは完全に機能しています。

フォントポップオーバー内にサイズと通知を変更するスライダーがあり、通知内でviewWillAppearを呼び出すと、フォントの変更と同じように機能します。

- (void)aFontChanged:(NSNotification *)notification
{
    NSLog(@"aFontChanged notification?");
    [self viewWillAppear:YES];
    [self refreshBodyText];
    [self refreshDateFont];
    [self refreshTitleFont];
}

- (void)aFontSizeChanged:(NSNotification *)notification
{
    NSLog(@"aFontSizeChanged notification?");
    [self viewWillAppear:YES];
    [self refreshBodyText];
    [self refreshDateFont];
    [self refreshTitleFont];
}
于 2012-12-26T07:30:40.803 に答える