小编Sae*_*Kim的帖子

如何在Swift中使用MKPolylineView

我想在我的Swift应用程序中绘制折线.

SWIFT代码

class MapViewController: UIViewController, MKMapViewDelegate {

    @IBOutlet var theMapView: MKMapView

    override func viewDidLoad() {
        super.viewDidLoad()
        setMapView()
    }

    func setMapView() {
        //theMapView.zoomEnabled = false
        //theMapView.scrollEnabled = false 
        theMapView.rotateEnabled = false  

        // 
        var lat: CLLocationDegrees = 37.586601
        var lng: CLLocationDegrees = 127.009381

        // 
        var latDelta: CLLocationDegrees = 0.008
        var lngDelta: CLLocationDegrees = 0.008

        var theSpan: MKCoordinateSpan = MKCoordinateSpanMake(latDelta, lngDelta)

        var initLocation: CLLocationCoordinate2D = CLLocationCoordinate2DMake(lat, lng)
        var theRegion: MKCoordinateRegion = MKCoordinateRegionMake(initLocation, theSpan)
        self.theMapView.setRegion(theRegion, animated: true)

        var locations = [CLLocation(latitude: 37.582691, longitude: 127.011186), …
Run Code Online (Sandbox Code Playgroud)

ios mkpolyline swift

11
推荐指数
1
解决办法
8809
查看次数

如何在swift中使用objectAtIndex

*IDE:XCODE 6 beta3
*语言:Swift + Objective C

这是我的代码.

目标C代码

@implementation arrayTest
{
    NSMutableArray *mutableArray;
}
- (id) init {
    self = [super init];
    if(self) {
        mutableArray = [[NSMutableArray alloc] init];
    }
    return self;
}
- (NSMutableArray *) getArray {
          ...
    return mutableArray; // mutableArray = {2, 5, 10}
}
Run Code Online (Sandbox Code Playgroud)

SWIFT代码

var target = arrayTest.getArray() // target = {2, 5, 10} 

for index in 1...10 {
    for targetIndex in 1...target.count { // target.count = 3
        if index == target.objectAtIndex(targetIndex-1) as Int …
Run Code Online (Sandbox Code Playgroud)

objective-c ios swift

6
推荐指数
1
解决办法
2万
查看次数

如何减少单选按钮的可绘制尺寸?

我有四个单选按钮.

xml源码

<RadioButton
    android:id="@+id/fragBtn1"
    android:layout_width="0dp"
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:background="@drawable/btn_bg_selector"
    android:button="@null"
    android:drawableTop="@drawable/btn_img_selector" />
Run Code Online (Sandbox Code Playgroud)

btn_img_selector

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/selected_btn" android:gravity="center" android:state_checked="true"/>
    <item android:drawable="@drawable/nonselected_btn" android:gravity="center"/>
</selector>
Run Code Online (Sandbox Code Playgroud)

btn_bg_selector

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@color/btnPressed" android:state_pressed="true"/>
    <item android:drawable="@color/btnNonPressed"/>
</selector>
Run Code Online (Sandbox Code Playgroud)

但按钮图像太大了.
我想仅减小按钮图像尺寸..(不减小按钮尺寸)
例如,我想缩放按钮图像尺寸30px*30px.
可能吗?

android

6
推荐指数
2
解决办法
6856
查看次数

我怎样才能检查android中的dex数?

我项目的gradle文件如下.

android {
    compileSdkVersion 23
    buildToolsVersion "25.0.1"

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt')
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

在Android Studio中"Generate Signed APK"时,我可以看到DexIndexOverflowException.

Error:Execution failed for task ':MyProject:transformClassesWithDexForRelease'.
> com.android.build.api.transform.TransformException: 
com.android.ide.common.process.ProcessException: 
java.util.concurrent.ExecutionException: 
com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
Run Code Online (Sandbox Code Playgroud)

我已经知道这个错误并阅读了文档(https://developer.android.com/studio/build/multidex.html).
我想查看已经超过了多少dex.

例如:

trouble writing output:
Too many field references: 99999; max is 65536.
You may try using --multi-dex option.
Run Code Online (Sandbox Code Playgroud)

请找一个解决方案.
谢谢

android dex android-studio android-multidex

6
推荐指数
2
解决办法
6158
查看次数