Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @interface ViewController : UITableViewController
- @end
- @implementation ViewController
- - (void)viewDidLoad
- {
- [super viewDidLoad];
- UIView* redSquare = [[UIView alloc] initWithFrame:CGRectZero];
- redSquare.backgroundColor = [UIColor redColor];
- [self.view addSubview:redSquare];
- [redSquare setTranslatesAutoresizingMaskIntoConstraints:NO];
- [redSquare.topAnchor constraintEqualToAnchor:self.view.topAnchor].active = YES;
- [redSquare.widthAnchor constraintEqualToConstant:100].active = YES;
- [redSquare.heightAnchor constraintEqualToConstant:100].active = YES;
- }
- -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
- {
- return 1;
- }
- -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- {
- return 5;
- }
- -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- static NSString* reuseIdentifier = @"ri";
- UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier];
- if (!cell)
- {
- cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier];
- }
- return cell;
- }
- @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement