Mkmapview circular Swift

Asked

Viewed 229 times

2

I wonder if you can leave Mkmapview in Xcode with circular format. I tried to use mapView.layer.cornerRadius, but I still could not

  • You imported the Quartzcore. h (#import <QuartzCore/QuartzCore.h>)? Without it the cornerRadius will have no effect.

1 answer

3


I did a test here and saw that using cornerRadius works normally.

1. Add the QuarzCore.framework in the project going in Build Phases > Link Binary with Libraries.

1.1
Build Phases

1.2
Link Binary With Libraries

2. Import QuartzCore in your project

Swift:

import QuartzCore;

Objective-C:

#import <QuartzCore/QuartzCore.h>

3. Use the property corerRadius view layer.

// cornerRadius com metade da altura de uma view quadrada deixa ela redonda
// neste caso uma view de 290x290
mapView.layer.cornerRadius = 145; 

Upshot

inserir a descrição da imagem aqui

  • Thanks is working now, it was more math error even. It had to be a square and the radius half the square.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.