Tôi đã thêm UIButton, UITextView làm chế độ xem phụ vào chế độ xem của tôi, theo chương trình.cách xóa các chế độ xem phụ
notesDescriptionView = [[UIView alloc]initWithFrame:CGRectMake(0,0,320,460)];
notesDescriptionView.backgroundColor=[UIColor redColor];
[self.view addSubview:notesDescriptionView];
textView = [[UITextView alloc] initWithFrame:CGRectMake(0,0,320,420)];
[self.view addSubview:textView];
printf("\n description button \n");
button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button
addTarget:self action:@selector(cancel:)
forControlEvents:UIControlEventTouchDown];
[button setTitle:@"OK" forState:UIControlStateNormal];
button.frame = CGRectMake(80.0, 420.0, 160.0, 40.0);
[self.view addSubview:button];
đây nếu chúng ta bấm nút, tôi cần phải loại bỏ tất cả các quan điểm phụ,
tôi đang cố gắng
[self.view removeFromSuperView]
nhưng nó không làm việc
bất kỳ sự giúp đỡ.
còn nút, tôi đã tạo bằng cách thêm làm chế độ xem phụ. thực sự tôi đang cố gắng hiển thị chế độ xem với chế độ xem văn bản, khi nhấn nút, sau khi tôi nhấp vào nút khác ở chế độ xem hiện tại, nó phải quay lại chế độ xem trước đó của tôi. – mac
tôi đã thử [notesDescriptionView removeFromSuperview]; [textView removeFromSuperview]; nhưng không hoạt động. – mac
Cách nào đúng để gọi một phương thức loại bỏ chế độ xem phụ từ superview khỏi lớp khác? Tôi đang thử phương pháp đại biểu nhưng nó không hoạt động. – SanitLee