#import "ViewController.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIScrollView *scrollViewForAccordian;
@end
@implementation ViewController
@synthesize scrollViewForAccordian;
- (void)viewDidLoad {
[super viewDidLoad];
[self makeCell];
}
- (void)makeCell {
//Making the Cell
UIView *viewForOutertable = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ([[ UIScreen mainScreen ] bounds].size.width), 44)];
viewForOutertable.translatesAutoresizingMaskIntoConstraints = NO;
NSDictionary *viewsDictionary = @{@"Cell":viewForOutertable};
NSArray *constraint_V = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[myCell]-0-|"
options:0
metrics:nil
views:viewsDictionary];
[viewForOutertable addConstraint:constraint_V];
//Setting the buttons
UIButton *buttonToEnlarge = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, ([[ UIScreen mainScreen ] bounds].size.width) , 44)];
[buttonToEnlarge setImage:[UIImage imageNamed:@"ltgrey.jpg"]
forState:UIControlStateNormal];
[buttonToEnlarge setImage:[UIImage imageNamed:@"grey.jpg"]
forState:UIControlStateSelected];
[buttonToEnlarge addTarget:self
action:@selector(expandButtonTapped:)
forControlEvents: UIControlEventTouchUpInside];
[viewForOutertable addSubview:buttonToEnlarge];
[scrollViewForAccordian addSubview:viewForOutertable];
}
-(void)expandButtonTapped:(UIButton *)sender {
NSLog(@"Button Clicked");
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
Comments