how can i Draw a line in ios map using overlayer - google-maps-api-3

I want to draw a line on ios map using overlayer. I have one code for draw a line on map. But it is not working for me. Can any one help me.
MKCoordinateSpan span;
span.latitudeDelta=.03;
span.longitudeDelta=.03;
MKCoordinateRegion region;
region.span=span;
region.center=CLLocationCoordinate2DMake(39.046259, -76.851195);
[_myMapView setRegion:region animated:YES];
[_myMapView regionThatFits:region];
UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:#selector(singleTapWebView:)];
singleTap.numberOfTapsRequired = 1;
singleTap.delegate = self;
[self.myMapView addGestureRecognizer:singleTap];
[singleTap release];
CLLocationCoordinate2D commuterLotCoords[5]=
{
CLLocationCoordinate2DMake(39.036399,-76.872208)
};
MKPolygon *commuterParkingPolygon=[MKPolygon polygonWithCoordinates:commuterLotCoords count:5];
[_myMapView addOverlay:commuterParkingPolygon];
In this above code we can change the end point from this line"CLLocationCoordinate2DMake(39.036399,-76.872208)" But in always the start point is
lat 0.000003, long 0.000000. how can i change the start pint. Could any one help me to solve this issue.

Related

location in google map api and apple MKMapKit are different

i am using maps.googleapis.com/maps/api/directions/json? for route plotting in objc . when i plot the line there is a slight change of coordinate , means the pin and the polyline don't intersect . Is there any way to plot with exact points in MKMap.
my code
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:#"https://maps.googleapis.com/maps/api/directions/json?origin=%f,%f&destination=%f,%f&sensor=false&mode=driving", agentLati, agentLogi, userLati, userLogi]];
..........
if (polyLine !=nil) {
[_route_Map removeOverlay:polyLine];
}
polyLine = [[MKPolyline alloc]init];
// polyLine = [self polylineWithEncodedString:[[[[responseDict objectForKey:#"routes"] objectAtIndex:0]objectForKey:#"overview_polyline"] objectForKey:#"points"]];
polyLine = [self polylineWithEncodedString:[[[[responseDict objectForKey:#"routes"] objectAtIndex:0]objectForKey:#"overview_polyline"] objectForKey:#"points"]];
[_route_Map addOverlay:polyLine];

AVPlayer volume is not adjusting while AirPlay

I am working on a custom audio player.
I am using a UISlider to adjust volume.It is working fine when I play on iPad.
But when I use AirPlay volume does not adjust.
Here is my code to adjust volume.
UISlider* slide = sender;
NSArray *audioTracks = [myPlayer.currentItem.asset tracksWithMediaType:AVMediaTypeAudio];
NSMutableArray *allAudioParams = [NSMutableArray array];
for (AVAssetTrack *track in audioTracks) {
AVMutableAudioMixInputParameters *audioInputParams =[AVMutableAudioMixInputParameters audioMixInputParametersWithTrack:track];
[audioInputParams setVolume:slide.value atTime:myPlayer.currentTime];
[audioInputParams setTrackID:[track trackID]];
[allAudioParams addObject:audioInputParams];
}
AVMutableAudioMix *audioZeroMix = [AVMutableAudioMix audioMix];
[audioZeroMix setInputParameters:allAudioParams];
[myPlayer.currentItem setAudioMix:audioZeroMix];

How can I change (modify) video frame rate and bit rate?

I need re-encoding a video file from photo library for web site service.
I tried below code but it has occurred error like 'video composition must have composition instructions'.
(code)
AVAsset *anAsset = [[AVURLAsset alloc] initWithURL:videoFileUrl options:nil];
NSArray *compatiblePresets = [AVAssetExportSession exportPresetsCompatibleWithAsset:anAsset];
if ([compatiblePresets containsObject:AVAssetExportPresetMediumQuality]) {
self.exportSession = [[AVAssetExportSession alloc]
initWithAsset:anAsset presetName:AVAssetExportPresetPassthrough];
AVMutableComposition* mixComposition = [[AVMutableComposition alloc] init];
AVMutableCompositionTrack *firstTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeVideo preferredTrackID:kCMPersistentTrackID_Invalid];
[firstTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, anAsset.duration) ofTrack:[[anAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0] atTime:kCMTimeZero error:nil];
AVMutableVideoCompositionLayerInstruction *FirstlayerInstruction = [AVMutableVideoCompositionLayerInstruction videoCompositionLayerInstructionWithAssetTrack:firstTrack];
AVMutableVideoCompositionInstruction * MainInstruction = [AVMutableVideoCompositionInstruction videoCompositionInstruction];
MainInstruction.layerInstructions = [NSArray arrayWithObjects:FirstlayerInstruction,nil];
AVMutableVideoComposition *MainCompositionInst = [AVMutableVideoComposition videoComposition];
MainCompositionInst.frameDuration = CMTimeMake(1, 30); // bit rate
MainCompositionInst.renderSize = CGSizeMake(640, 480); // frame rate
[self.exportSession setVideoComposition:MainCompositionInst];
NSURL *furl = [NSURL fileURLWithPath:self.tmpVideoPath];
self.exportSession.outputURL = furl;
self.exportSession.outputFileType = AVFileTypeQuickTimeMovie;
CMTime start = CMTimeMakeWithSeconds(self.startTime, anAsset.duration.timescale);
CMTime duration = CMTimeMakeWithSeconds(self.stopTime-self.startTime, anAsset.duration.timescale);
CMTimeRange range = CMTimeRangeMake(start, duration);
self.exportSession.timeRange = range;
self.trimBtn.hidden = YES;
self.myActivityIndicator.hidden = NO;
[self.myActivityIndicator startAnimating];
[self.exportSession exportAsynchronouslyWithCompletionHandler:^{
switch ([self.exportSession status]) {
case AVAssetExportSessionStatusFailed:
NSLog(#"Export failed: %#", [[self.exportSession error] localizedDescription]);
break;
case AVAssetExportSessionStatusCancelled:
NSLog(#"Export canceled");
break;
default:
NSLog(#"NONE");
dispatch_async(dispatch_get_main_queue(), ^{
[self.myActivityIndicator stopAnimating];
self.myActivityIndicator.hidden = YES;
self.trimBtn.hidden = NO;
[self playMovie:self.tmpVideoPath];
});
break;
}
}];
}
}
without the changing frame rate and bit rate, it works perfectly.
Please give me any advise.
Thanks.
Framerate I'm still looking for, but bitrate has been solved by this drop in replacement for AVAssetExportSession: https://github.com/rs/SDAVAssetExportSession
Not sure but some things to look at. Unfortunatley the error messages dont tell you much in these cases in AVFoundation.
In general, I would make things simple and slowly add functionality.To start, make sure all layers start at zero and then end at the final duration. Do the same for the main composition. Invalid times may give you an error like this. For your instruction, make sure that it starts at the same time and ends at the same time too.

Apple - UISearchBar issue with UINavigationConroller

Using storyboard I have created one UINavigationController and two UITableViewContorllers:
(MasterViewContoller)
and
(Level2Contoller).
Both UITableViewControllers have UISearchBar at top. MasterViewContoller is set as root of UINavigationConroller.
Now the problem is that when I use below code to go to level2, I am not getting a seach bar on Level2Contoller.
level2Contoller *l2 = [[level2Contoller alloc]init];
[[self navigationController] pushViewController :l2 animated:YES];
Solution:
I used this:
level2Contoller * level2Contoller = [self.storyboard instantiateViewControllerWithIdentifier:#"id1"];
instead of:
level2Contoller *l2 = [[level2Contoller alloc]init];

NSAttributedString Strikethrough does not draw over entire length of text

I am inserting an NSAttributedString into an NSTableView, and depending on it's content I am adding attributes to its style dictionary.
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex {
NSAttributedString *theValue;
NSMutableDictionary *attributes = [[NSMutableDictionary alloc] init];
[attributes setObject:[NSFont systemFontOfSize:11] forKey:NSFontAttributeName];
currentObject = [ticketsDataSource objectAtIndex:rowIndex];
if ([[currentObject valueForKey:aTableColumn.identifier] isKindOfClass:([NSString class])]) {
NSString *currentValue = [currentObject valueForKey:aTableColumn.identifier];
if ([currentValue isEqualToString:#"resolved"]) {
[attributes setObject:[NSColor colorWithCalibratedRed:0.344 green:0.619 blue:0.000 alpha:1.000] forKey:NSForegroundColorAttributeName];
}
if ([previousValue isEqualToString:#"resolved"]) {
[attributes setObject:[NSNumber numberWithInteger:NSUnderlinePatternSolid | NSUnderlineStyleSingle] forKey:NSStrikethroughStyleAttributeName];
}
theValue = [[NSAttributedString alloc] initWithString:currentValue attributes:attributes];
previousValue = currentValue;
}
As you can see, basically what happens is when it writes a string called "resolved" it knows that the very next column, which is the title column, gets a strikethrough. It works just fine, but for whatever reason, the strikethrough is not drawing over the entirety of the text!
Here is an image:
What is going on here?
Yet another weirdness with layer-backing. So I turned it off :(

Resources