/*--------------------------------------------------------------------------- * Load movie player from your viewcontroller *--------------------------------------------------------------------------*/ - (void)loadMoviePlayer { // Play movie from the bundle NSString *path = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"mp4" inDirectory:nil]; // Create custom movie player moviePlayer = [[CustomMoviePlayerViewController alloc] initWithPath:path]; // Show the movie player as modal [self presentViewController:moviePlayer animated:YES completion:nil]; // Prep and play the movie [moviePlayer readyPlayer]; }
Thursday, 29 January 2015
Play Movie Player in landscape mode ios8
Wednesday, 28 January 2015
sizewithfont:constrainedToSize:lineBreakMode: deprectataed in HUD
replace this text
CGSize labelSize = [detailsLabel.text boundingRectWithSize:CGSizeMake(frame.size.width - 4*margin, maxHeight) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:detailsLabel.font} context:nil].size;
Tuesday, 27 January 2015
Code execution time in ios
NSDate *methodStart = [NSDate date]; ////--- code to calculate execution time NSDate *methodFinish = [NSDate date]; NSTimeInterval executionTime = [methodFinish timeIntervalSinceDate:methodStart]; NSLog(@"executionTime(seconds) = %f", executionTime);
Tuesday, 20 January 2015
Call https webservice thourgh iOS code; NSURLConnection to connect with SSL for an untrusted cert?
If yor are getting this error
NSURLConnection/CFURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813);
NSURLConnection/CFURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813);
Tuesday, 13 January 2015
Post data to server in iOS [Image + data fields ]
// URL
NSString *strURL = [SiteAPIURL stringByAppendingFormat:@"AddChild.php"];
// field values to post [text]
NSDictionary *parameterToAdd = @{@"UserId":userID,
@"ChildFName":[txtViewFName.text trim],
@"ChildLName":[txtViewLName.text trim],
@"SafetyZone":isSafetyZone?@"YES":@"NO",
@"AlarmTone":lblAlarmToneName.text,
@"ChildId":@"0"};
// image to post [Data / image ] ==>>is used to send image;
UIImage *imgToSend = imgViewPickerPhoto.image;
[postBody appendData:[@"Content-Disposition: form-data; name=\"Image\"; filename=\"image.jpg\"\r\n" dataUsingEncoding:NSUTF8StringEncoding]];
whole code
Wednesday, 7 January 2015
Python web server
from pprint import pformat from wsgiref.simple_server import make_server def app(environ, start_response): headers = {'Content-Type': 'text/plain; charset=utf-8'} start_response('200 OK', list(headers.items())) #yield is used to send back response yield 'Here is the WSGI environment:\r\n\r\n'.encode('utf-8') yield pformat(environ).encode('utf-8') path = environ.get('PATH_INFO', '/') print path if __name__ == '__main__': httpd = make_server('', 8000, app) host, port = httpd.socket.getsockname() print('Serving on', host, 'port', port) httpd.serve_forever()python Server.py
run at browser as http://ip:8000/ ===>>> http://localhost:8000/
Subscribe to:
Posts (Atom)