I am a developer

Shake view animation

-(void)shakeView {
    
    CABasicAnimation *shake = [CABasicAnimation animationWithKeyPath:@"position"];
    [shake setDuration:0.1];
    [shake setRepeatCount:2];
    [shake setAutoreverses:YES];
    [shake setFromValue:[NSValue valueWithCGPoint:
                         CGPointMake(view.center.x - 5,view.center.y)]];
    [shake setToValue:[NSValue valueWithCGPoint:
                       CGPointMake(view.center.x + 5, view.center.y)]];
    [view.layer addAnimation:shake forKey:@"position"];
    AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);

}

Open link with safari browser iOS

NSURL *url = [NSURL URLWithString:@"http://www.stackoverflow.com"];
if (![[UIApplication sharedApplication] openURL:url]) {
    NSLog(@"%@%@",@"Failed to open url:",[url description]);
}
NSURL *url = [NSURL URLWithString:@"http://www.stackoverflow.com"];

if (![[UIApplication sharedApplication] openURL:url]) {
    NSLog(@"%@%@",@"Failed to open url:",[url description]);
}

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://www.google.com"]];

How to detect System sound volume

float vol = [[AVAudioSession sharedInstance] outputVolume];
NSLog(@"output volume: %1.2f dB", 20.f*log10f(vol+FLT_MIN));
 MPMusicPlayerController *iPod = [MPMusicPlayerController iPodMusicPlayer];    float volumeLevel = iPod.volume;

Add auto layout


Add table view

self.tableView = [[UITableView alloc] init];
[self.view addSubview:self.tableView];

[self.tableView setTranslatesAutoresizingMaskIntoConstraints:NO];

Visual Style

id viewsDictionary = @{@"tblview": self.tableView};
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-5-[tblview]-5-|" options:0 metrics:nil views:viewsDictionary]];
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-20-[tblview]-60-|" options:0 metrics:nil views:viewsDictionary]];

Normal Style

[self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.tableView attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeading multiplier:1.0 constant:5.0]];

[self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.tableView attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTrailing multiplier:1.0 constant:5.0]];


[self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.tableView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:20.0]];