Skip to content

Button in Code Objective C 0

Azmal Tech edited this page Dec 27, 2016 · 1 revision
  UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
  [button addTarget:self action:@selector(playVideo)forControlEvents:UIControlEventTouchUpInside];
  // PlayVideo is a method name it has been called
  [button setTitle:@"Press Me" forState:UIControlStateNormal];
 // [button setBackgroundImage:[UIImage imageNamed:@"video_cover.png"] forState:UIControlStateNormal];
  button.frame = CGRectMake(100, 100, 100, 30);
 //  button.frame = CGRectMake(0.0, 44, screenWidth, (screenWidth * image.size.height ) image.size.width );
  [self.view addSubview:button];
Clone this wiki locally