iPadアプリケーション用のカスタムUIButtonで作成しました。
特定の理由から、これらのボタンを非表示にしたいと思います。そのために、次のコードを使用しています。
NSMutableArray *viewArray = [[NSMutableArray alloc] init];
// Get all the windows
for (UIWindow *window in [[UIApplication sharedApplication] windows])
{
// check for main screen
if (![window respondsToSelector:@selector(screen)] ||
[window screen] == [UIScreen mainScreen])
{
// check for all the subviews available in window
for (UIView * view in [window subviews]) {
// check whether it supports this method
if ([view respondsToSelector:@selector(isKindOfClass:)]) {
// type cast to button
// UIButton *btn = (UIButton *)view;
// if its type of my custom button class
if ([[view class] isKindOfClass:[DINNextLTProBoldButton class]]) {
// hide view and add to array
[view setHidden:YES];
[viewArray addObject:view];
}
}
}
}
}
しかし、この配列でカスタム ボタンを取得できません。ウィンドウ/画面に表示されているビューにそれらのボタンがあると思っても、空のままです。
どこが間違っているのですか?私を案内してください。