Skip to content

Instantly share code, notes, and snippets.

@barrettj
Created September 16, 2015 17:21
Show Gist options
  • Save barrettj/fb7740136e2812c0bf46 to your computer and use it in GitHub Desktop.
Save barrettj/fb7740136e2812c0bf46 to your computer and use it in GitHub Desktop.
Demonstrating Table Issue with STPopup
//
// PopupViewController1.h
// STPopup
//
// Created by Kevin Lin on 11/9/15.
// Copyright (c) 2015 Sth4Me. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface PopupViewController1 : UITableViewController
@end
//
// PopupViewController1.m
// STPopup
//
// Created by Kevin Lin on 11/9/15.
// Copyright (c) 2015 Sth4Me. All rights reserved.
//
#import "PopupViewController1.h"
#import "PopupViewController2.h"
#import "STPopup.h"
@implementation PopupViewController1
- (instancetype)init
{
if (self = [super init]) {
self.title = @"TableView";
self.contentSizeInPopup = CGSizeMake(300, 400);
self.landscapeContentSizeInPopup = CGSizeMake(400, 200);
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
[self.tableView registerClass:UITableViewCell.class forCellReuseIdentifier:@"Identifier"];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Next" style:UIBarButtonItemStylePlain target:self action:@selector(nextBtnDidTap)];
}
- (void)nextBtnDidTap
{
[self.popupController pushViewController:[PopupViewController2 new] animated:YES];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 20;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Identifier"];
cell.textLabel.text = [NSString stringWithFormat:@"%ld", (long)indexPath.row];
return cell;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment