0
두 개의 컨트롤이있는보기 하나를 포함하여 여러 개의 세그먼트 컨트롤이있는 iPad 앱이 있습니다.xcode : 세그먼트 컨트롤이 기기가 아닌 sim에 표시됩니다.
이보기에서 모든 것이 정상 및 망막 모두에서 시뮬레이션에 표시됩니다. 그러나 장치에는 하나만 표시됩니다.
다음은 장치에 표시되지 않는 코드입니다. 확인한 다음 컨트롤을 구성하는 모든 이미지가 번들 리소스에 복사됩니다. 제거, 청소 등을 시도했습니다. 기쁨이 없습니다. 나는 참고로
UISegmentedControl *controls = [[UISegmentedControl alloc] initWithItems:
[NSArray arrayWithObjects:
[UIImage imageNamed:@"1.png"],
[UIImage imageNamed:@"2.png"],
[UIImage imageNamed:@"3.png"],
[UIImage imageNamed:@"4.png"],
[UIImage imageNamed:@"5.png"],
[UIImage imageNamed:@"6.png"],
[UIImage imageNamed:@"7.png"],
nil]];
CGRect frame = CGRectMake(35, 70, 700, 35);
controls.frame = frame;
}
[controls addTarget:self action:@selector(drawSegmentAction:) forControlEvents:UIControlEventValueChanged];
controls.segmentedControlStyle = UISegmentedControlStyleBar;
controls.momentary = YES;
controls.tintColor = [UIColor grayColor];
[self.view addSubview:controls];
}
.. (희망 단순) 뭔가 빠진해야 동일한 뷰에서이 코드는 수행 업무 :
참고로,이 제어 코드가하는 일 :
-(void) buildColorBar {
//NSLog(@"%s", __FUNCTION__);
UISegmentedControl *colorControl = [[UISegmentedControl alloc] initWithItems:
[NSArray arrayWithObjects: [UIImage imageNamed:@"White.png"],
[UIImage imageNamed:@"Red.png"],
[UIImage imageNamed:@"Yellow.png"],
[UIImage imageNamed:@"Green.png"],
[UIImage imageNamed:@"Blue.png"],
[UIImage imageNamed:@"Purple.png"],
[UIImage imageNamed:@"Black.png"],
nil]];
NSLog(@"Portrait");
CGRect frame = CGRectMake(35, 950, 700, 35);
colorControl.frame = frame;
// When the user chooses a color, the method changeBrushColor: is called.
[colorControl addTarget:self action:@selector(changeBrushColor:) forControlEvents:UIControlEventValueChanged];
colorControl.segmentedControlStyle = UISegmentedControlStyleBar;
// Make sure the color of the color complements the black background
colorControl.tintColor = [UIColor grayColor];
// Add the control to the window
[self.view addSubview:colorControl];
}
하나의보기에서 두 개의 분할 된 컨트롤을 사용하는 것에 대한 규칙이 있습니까?
확실한 질문 ... 당신은 NSLog에 넣어 코드가 실행되고 있는지 확인 했습니까? 그냥 임의의 배경색으로 컨트롤을 만드는 데 문제가 있는지 또는 기본 레이아웃이 더 많은지/하위 뷰 문제가 추가되는지 확인하기 위해 UIView를 만드는 방법은 무엇입니까? – DBD
예, 코드가 기록되어 실행 중입니다. 나는 버튼이 너무 작동한다는 것을 알 수있다. 이상한 ... –