Image Get From Video (Video Image)

-(UIImage *)getThumbNail:(NSString*)stringPath
{
    NSURL *videoURL = [NSURL fileURLWithPath:stringPath];
    
    MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];
    
    UIImage *thumbnail = [player thumbnailImageAtTime:1.0 timeOption:MPMovieTimeOptionNearestKeyFrame];
    
    //Player autoplays audio on init
    [player stop];
   
    return thumbnail;
}
Advertisements

Dynamically Set lable size in View

– (void) viewWillAppear:(BOOL)animated

{

    dynamicLable = [[UILabelalloc] initWithFrame:CGRectMake(50, 50,100, 20)];

    dynamicLable.numberOfLines = 0;

    dynamicLable.lineBreakMode = NSLineBreakByCharWrapping;

    dynamicLable.font = [UIFontfontWithName:@”System”size:17];

    dynamicLable.text = @”ierhgh riehti rtiury iureyituyr iroeyti ryi tiryioty iretyioyrity iryti yuityio yeirt oiirto ifegiy iretyiuyret ryuiti ireuytyreitu uiyt irt  iehti rtiury iureyituyr iroeyti ryi tiryioty iretyioyrity iryti yuityio yeirt oiirto ifegiy iretyiuyret ryuiti ireuytyreitu uiyt irt”;

    CGRect frame = dynamicLable.frame;

    frame.size.width = 230.0f;

    frame.size = [dynamicLable sizeThatFits:frame.size];

    dynamicLable.frame = frame;

    [self.viewaddSubview:dynamicLable];

}