我有一个UIImageView在其中UIImage正显示出它来自JSON.问题是我想设置cornerRadius为UIImageView.我为它添加了以下代码:
imgVw.layer.cornerRadius = 30.0;
imgVw.layer.borderWidth = 2.0;
imgVw.layer.borderColor = [UIColor blackColor].CGColor;
Run Code Online (Sandbox Code Playgroud)
它以正确的方式显示cornerRadius和边框UIImageView但不显示.图像显示在角落之外,如屏幕截图所示.
在我的项目中,我将借助纬度和经度找出两个位置之间的路径.
我正在使用以下代码
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[mapvw setDelegate:self];
[self mapp];
}
-(void)mapp
{
CLLocationCoordinate2D coordinateArray[2];
coordinateArray[0] = CLLocationCoordinate2DMake(28.6129, 77.2295);
coordinateArray[1] = CLLocationCoordinate2DMake(28.6562, 77.2410);
self.routeLine = [MKPolyline polylineWithCoordinates:coordinateArray count:2];
[mapvw setVisibleMapRect:[self.routeLine boundingMapRect]]; //If you want the route to be visible
[mapvw addOverlay:self.routeLine];
}
-(MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id<MKOverlay>)overlay
{
if(overlay == self.routeLine)
{
if(nil == self.routeLineView)
{
self.routeLineView = [[MKPolylineView alloc] initWithPolyline:self.routeLine];
self.routeLineView.fillColor = [UIColor redColor];
self.routeLineView.strokeColor = …Run Code Online (Sandbox Code Playgroud)