コードはうまく動作していますが、コードはうまくいきません。コードを書き込むためのよりよい方法を探しています。ユーザーの数は私が必要なので、利用可能なユーザーに基づいてビューを非表示にすることです11は、11人のユーザーと利用可能な2だけ11の2になると言うことができます。アプリケーションは1番目のビューと2番目のビューを非表示にしますあなたはの配列を作成します3から11までの景色などを使用できコードのショートカット
NSInteger countOfViews = 2;
if (countOfViews == 1) {
UIView *viewtag1 = (UIView *)[self.leftScrollView viewWithTag:1000];
UIView *viewtag2 = (UIView *)[self.leftScrollView viewWithTag:2000];
UIView *viewtag3 = (UIView *)[self.leftScrollView viewWithTag:3000];
UIView *viewtag4 = (UIView *)[self.leftScrollView viewWithTag:4000];
UIView *viewtag5 = (UIView *)[self.leftScrollView viewWithTag:5000];
UIView *viewtag6 = (UIView *)[self.leftScrollView viewWithTag:6000];
UIView *viewtag7 = (UIView *)[self.leftScrollView viewWithTag:7000];
UIView *viewtag8 = (UIView *)[self.leftScrollView viewWithTag:8000];
UIView *viewtag9 = (UIView *)[self.leftScrollView viewWithTag:9000];
UIView *viewtag10 = (UIView *)[self.leftScrollView viewWithTag:10000];
UIView *viewtag11 = (UIView *)[self.leftScrollView viewWithTag:11000];
viewtag1.hidden = YES;
viewtag2.hidden = NO;
viewtag3.hidden = NO;
viewtag4.hidden = NO;
viewtag5.hidden = NO;
viewtag6.hidden = NO;
viewtag7.hidden = NO;
viewtag8.hidden = NO;
viewtag9.hidden = NO;
viewtag10.hidden = NO;
viewtag11.hidden = NO;
}
if (countOfViews == 2) {
UIView *viewtag1 = (UIView *)[self.leftScrollView viewWithTag:1000];
UIView *viewtag2 = (UIView *)[self.leftScrollView viewWithTag:2000];
UIView *viewtag3 = (UIView *)[self.leftScrollView viewWithTag:3000];
UIView *viewtag4 = (UIView *)[self.leftScrollView viewWithTag:4000];
UIView *viewtag5 = (UIView *)[self.leftScrollView viewWithTag:5000];
UIView *viewtag6 = (UIView *)[self.leftScrollView viewWithTag:6000];
UIView *viewtag7 = (UIView *)[self.leftScrollView viewWithTag:7000];
UIView *viewtag8 = (UIView *)[self.leftScrollView viewWithTag:8000];
UIView *viewtag9 = (UIView *)[self.leftScrollView viewWithTag:9000];
UIView *viewtag10 = (UIView *)[self.leftScrollView viewWithTag:10000];
UIView *viewtag11 = (UIView *)[self.leftScrollView viewWithTag:11000];
viewtag1.hidden = YES;
viewtag2.hidden = YES;
viewtag3.hidden = NO;
viewtag4.hidden = NO;
viewtag5.hidden = NO;
viewtag6.hidden = NO;
viewtag7.hidden = NO;
viewtag8.hidden = NO;
viewtag9.hidden = NO;
viewtag10.hidden = NO;
viewtag11.hidden = NO;
}
/*
till if (countOfViews == 11)
*/
の[アウトレット集](http://useyourloaf.com/blog/interface-builder-outlet-collections/)アウトレット、それははるかにきれいになるだろう – Tj3n