How to align title of google map marker to right for RTL in ios? - ios8

I am using code below to set title in marker for google maps.
CLLocationCoordinate2D position = CLLocationCoordinate2DMake(lat, longi);
GMSMarker *marker = [GMSMarker markerWithPosition:position];
marker.title = self.TitleArray[i];
marker.map = mapView_;
}
Can anyone tell me how to align title to right ?

You can use
marker.title.textAlignment = UITextAlignmentRight;

Related

Adding different alignment and font size to different lines in one TextLabel in TableCell swift

so i'm trying to implement a simple english to farsi dictionary in iOS
i'd like to include both words in one table cell, problem is that english is L>R and farsi is R>L, also i'd like to make the farsi word a bit bigger.
I created an AttributedMutableString and I thought I put down all the correct values but it looks like there is a problem since it isn't rendering correctly.
code:
cell.textLabel?.numberOfLines = 0
var myString = "\(englishConvo[indexPath.row])\n\(farsiConvo[indexPath.row])"
var mutableString = NSMutableAttributedString()
var lenOfLang1 = englishConvo[indexPath.row].characters.count
var lenOfLang2 = farsiConvo[indexPath.row].characters.count
let increaseFontSize = UIFont(name: (cell.textLabel?.font.fontName)!, size: (cell.textLabel?.font?.pointSize)! + 5)
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.alignment = NSTextAlignment.Right
mutableString = NSMutableAttributedString(string: myString)
mutableString.addAttribute(NSParagraphStyleAttributeName, value: paragraphStyle, range: NSRange(location: lenOfLang1 + 1, length: lenOfLang2))
mutableString.addAttribute(NSFontAttributeName, value: increaseFontSize!, range: NSRange(location: lenOfLang1 + 1, length: lenOfLang2))
cell.textLabel?.attributedText = mutableString
If i convert to a string using this code this is what I get
cell.textLabel?.text = String(mutableString)
Any thoughts / ideas would be super appreciated
Table cells already come with a layout that gives you two labels (text and detail), so why not just use it? Here, for example, in a language app of mine, I'm displaying a Latin word in the text label and an English translation in the detail label. You could easily do the same with Farsi and English.

Tile Image not shown

I try to set my main tile with the templatew TileWide310x150SmallImageAndText02. I had a look at the sample code and took this out of it:
ITileSquare310x310SmallImagesAndTextList04 tileContent =
TileContentFactory.CreateTileSquare310x310SmallImagesAndTextList04();
tileContent.Image1.Src = "ms-appx:///Assets/Logo.png";
tileContent.TextHeading1.Text = "Cashflow";
tileContent.TextWrap1.Text = "Income: 500";
tileContent.TextWrap2.Text = "Spending: 400";
tileContent.TextWrap3.Text = "Earnings: 200";
// Create a notification for the Wide310x150 tile using one of the available templates for the size.
ITileWide310x150SmallImageAndText02 wide310x150Content =
TileContentFactory.CreateTileWide310x150SmallImageAndText02();
wide310x150Content.Image.Src = "ms-appx:///Assets/Logo.png";
wide310x150Content.TextHeading.Text = "Cashflow";
wide310x150Content.TextBody1.Text = "Income: 500";
wide310x150Content.TextBody2.Text = "Spending: 400";
wide310x150Content.TextBody3.Text = "Earnings: 200";
// Create a notification for the Square150x150 tile using one of the available templates for the size.
ITileSquare150x150PeekImageAndText01 square150x150Content =
TileContentFactory.CreateTileSquare150x150PeekImageAndText01();
square150x150Content.Image.Src = "ms-appx:///Assets/Logo.png";
square150x150Content.TextHeading.Text = "Cashflow";
square150x150Content.TextBody1.Text = "Income: 500";
square150x150Content.TextBody2.Text = "Spending: 300";
square150x150Content.TextBody3.Text = "Earnings: 200";
// Attach the Square150x150 template to the Wide310x150 template.
wide310x150Content.Square150x150Content = square150x150Content;
// Attach the Wide310x150 template to the Square310x310 template.
tileContent.Wide310x150Content = wide310x150Content;
// Send the notification to the application? tile.
TileUpdateManager.CreateTileUpdaterForApplication().Update(tileContent.CreateNotification());
This will show the tile correctly in the 150x150 size, but not in the wide. Then only the text is shown but not the image.
Here's a screenshot:
Thanks for your help!
NPadrutt
The SmallImageAndText Templates only show an Image on Windows, not on Phone.
Please refer to the template catalog for the direfences here.
Tipp: Template catalog is available at aka.ms/tiletemplates

Screen Capture on OSX using MonoMac?

Can somebody help me with the following code snippet to capture part of or the whole desktop on OSX ? I would like to specify the upper-left corner coordinates (x,y) and the width (w) and height (h) of the rectangle that defines the capture.
It's for a C# MonoMac application on OSX.
This is what I've done:
int windowNumber = 2;
System.Drawing.RectangleF bounds = new RectangleF(0,146,320,157);
CGImage screenImage = MonoMac.CoreGraphics.CGImage.ScreenImage(windowNumber,bounds);
MonoMac.Foundation.NSData bitmapData = screenImage.DataProvider.CopyData();
It looks like I have the bitmap data in 'bitmapData', but I'm not sure how I convert the NSData instance 'bitmapData' to an actual Bitmap; i.e. :
Bitmap screenCapture = ????
The documentation is really sparse and I've googled for examples without luck. So I'm hoping that there's a kind MonoMac expert out there who can point me in the right direction? - An example would be nice :o)
Thank you in advance!
This will give you the bytes of your capture in a .NET byte[], from where you can create a Bitmap or Image or whatever you want. Might not be exactly what you are looking for but should put you in the right direction.
int windowNumber = 2; System.Drawing.RectangleF bounds = new RectangleF(0,146,320,157);
CGImage screenImage = MonoMac.CoreGraphics.CGImage.ScreenImage(windowNumber,bounds);
using(NSBitmapImageRep imageRep = new NSBitmapImageRep(screenImage))
{
NSDictionary properties = NSDictionary.FromObjectAndKey(new NSNumber(1.0), new NSString("NSImageCompressionFactor"));
using(NSData tiffData = imageRep.RepresentationUsingTypeProperties(NSBitmapImageFileType.Png, properties))
{
byte[] imageBytes;
using(var ms = new MemoryStream())
{
tiffData.AsStream().CopyTo(ms);
imageBytes = ms.ToArray();
}
}
}

Bind line series to the additional Y-axis in radchart telerik

Im having radchart showing the 2 bar series and 2 line series.Bar series is showing according to the left side y axis and line series is not binding according to the right side additional y axis.right axis which line series has to bind but only one of them is binding and other is not showing it binding to the left Y-axis.
Please can anybody provide me any solution is much a appreciated
Try this:
AxisY axisY = new AxisY();
axisY.AxisName = "AxisY1";
axisY.Title = "";
axisY.IsZeroBased = true;
axisY.DefaultLabelFormat = "#VAL{P0}";
SellInproductChart.DefaultView.ChartArea.AdditionalYAxes.Add(axisY);
AxisY axisY1 = new AxisY();
axisY1.AxisName = "AxisY2";
axisY1.Title = "";
axisY1.IsZeroBased = true;
axisY1.DefaultLabelFormat = "#VAL{P0}";
SellInproductChart.DefaultView.ChartArea.AdditionalYAxes.Add(axisY1);
objSeriesMapping1.SeriesDefinition.AxisName = "AxisY1";
objSeriesMapping2.SeriesDefinition.AxisName = "AxisY2";

How to Get the the Current city name using gps in bing map

I have used bing map in my app,where i locate the current location using gps and i'm getting the co-ordinates using geoco-ordinatewatcher as well and pin the current location with pushpin. but my issue is that i wanna get the current city and country name where the pushpin is pointing. i couldn't get that using map.center property. can anyone help me out.. Thanks in advance...
The following blog post should assist you :-
http://www.nickharris.net/2010/12/how-to-reverse-geocode-a-location-to-an-address-on-windows-phone-7/
Unfortunately, the CivicAddressResolver is currently not implemented on Windows Phone so you would have to use an online based solution.
please, refer the below code
ReverseGeocodeRequest reverseGeocodeRequest = new ReverseGeocodeRequest();
// Set the credentials using a valid Bing Maps key
reverseGeocodeRequest.Credentials = new GeoCodeService.Credentials();
reverseGeocodeRequest.Credentials.ApplicationId = "Your bing map key";
// Set the point to use to find a matching address
GeoCodeService.Location point = new GeoCodeService.Location();
point.Latitude = Your lat;
point.Longitude = Your lng;
reverseGeocodeRequest.Location = point;
// Make the reverse geocode request
GeocodeServiceClient geocodeService = new GeocodeServiceClient("BasicHttpBinding_IGeocodeService");
geocodeService.ReverseGeocodeCompleted += new EventHandler<ReverseGeocodeCompletedEventArgs>(geocodeService_ReverseGeocodeCompleted);
geocodeService.ReverseGeocodeAsync(reverseGeocodeRequest);
void geocodeService_ReverseGeocodeCompleted(object sender, ReverseGeocodeCompletedEventArgse)
{
string text1;
GeocodeResponse geocodeResponse = e.Result;
System.Diagnostics.Debug.WriteLine("GeoCode Response is :"+geocodeResponse);
if (geocodeResponse.Results.Count() > 0)
text1 = geocodeResponse.Results[0].DisplayName;
else
text1 = "No Results found";
textBlock1.Text = text1;
System.Diagnostics.Debug.WriteLine("Location is :"+text1);
}
There is no way to resolve a location from lat/long coordinates on the device.
To do so would require that a database of all places ship with the device to do the lookup. Such a database would be huge and present issues with keeping it updated.

Resources