I am using objective-c.FirstViewController performs parse signup and then transitions to secondVC.The secondVC includes label, button, tableView, and imageView.TableView and imageView are drawn every time, but label and button are often not drawn.Why?
--- FirstViewController ---
-(void)moveToSecontVC{
PFUser* user = PFUser currentUser;
NSError* error=nil;
user signUp:&error;
if(!error){
SecondViewController*SecondVC = [[SecondViewController alloc] init];
[self presentViewController:createProfileVC animated:YES completion:nil];
}
}
--- SecondViewController ---
-(void)viewDidLoad{
superviewDidLoad;
UILabel* label = [[UILabel alloc] initWithFrame: CGRectMake(30,80,260,0)];
label.textAlignment=NSTextAlignmentCenter;
label.textColor=[UIColor whiteColor];
label.text=@"text";
self.view addSubview:label;
UITableView*tableView=[[UITableView alloc] initWithFrame: CGRectMake(0,200,self.view.frame.size.width,88)];
tableView.delegate=self;
tableView.dataSource=self;
tableView.allowsSelection=NO;
tableView.scrollEnabled = NO;
[self.view addSubview:tableView];
UIButton*button=[[UIButton alloc] initWithFrame: CGRectMake(30,296,260,60)];
button addTarget:selfaction:@selector(pushedContinue) forControlEvents:UIControlEventTouchUpInside;
[Button setImage: UIImage imageNamed:@"button"] forState:UIControlStateNormal;
self.view addSubview:button;
UIImageView* imageView=[[UIImageView alloc] initWithFrame: CGRectMake (115, 90, 90, 90)];
imageView.image=[UIImage imageNamed:@"image"];
[self.view addSubview: imageView];
}
---add ---
When I checked the recursiveDescription, it seemed that addSubView was done.Also, when I tap where button should be, button is now visible.
UILabel*label=[UILabel alloc] initWithFrame: CGRectMake(30,80,260,0)];
The height of the label
is 0
.I can't see it as it is.
For button
, you may have failed to retrieve an image from a resource.What happens if I use text instead of images?
UIButton*button=[[UIButton alloc] initWithFrame: CGRectMake(30,296,260,60)];
[Button setTitle: @ "Button" forState: UIControlStateNormal];
572 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
915 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
618 Uncaught (inpromise) Error on Electron: An object could not be cloned
611 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2024 OneMinuteCode. All rights reserved.