小编Mar*_*coz的帖子

防止多次点击同一个UIButton

有时在我的应用程序中我收到此错误,因为用户界面冻结,用户点击多次按钮:

"不支持多次推送同一个视图控制器实例"

我试过这个:

如何防止iOS中同一个UIButton上的多个事件?

它就像一个魅力,但如果我的tabbar有超过5个元素,如果我选中显示大于5的元素的按钮,则从左到右动画的按钮越多.

有没有其他方法来防止双标签以一种不使用动画的简单方式?

这是我正在使用的代码:

- (IBAction)btnAction:(id)sender {
    UIButton *bCustom = (UIButton *)sender;
    bCustom.userInteractionEnabled = NO;
    [UIView animateWithDuration:1.0 delay:0.0 options:UIViewAnimationOptionAllowAnimatedContent animations:^{
        [self selectTabControllerIndex:bCustom.tag];
    } completion:^(BOOL finished){
        bCustom.userInteractionEnabled = YES;
    }];
}
Run Code Online (Sandbox Code Playgroud)

objective-c uibutton ios

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

TIC TCP Conn失败

我用来获取.mjpeg视频源的服务器中有些变化.

现在我收到这个错误:

TIC TCP Conn失败[5:0x1d4361380]:3:-9802 Err(-9802)

TIC TCP Conn失败[6:0x1c0177a00]:3:-9800 Err(-9800)

TIC TCP Conn失败[7:0x1d4361440]:3:-9800 Err(-9800)

NSURLSession/NSURLConnection HTTP加载失败(kCFStreamErrorDomainSSL,-9800)

任务<2B8346B5-6BB2-4B92-B311-554410CBF92F>.<1> HTTP加载失败(错误代码:-1200 [3:-9800])

任务<2B8346B5-6BB2-4B92-B311-554410CBF92F>.<1>完成错误 - 代码:-1200

这是我收到错误的代码:

open func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {

    var credential: URLCredential?
    var disposition: Foundation.URLSession.AuthChallengeDisposition = .useCredential
    // Getting the authentication if stream asks it
    if challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust {
        if let trust = challenge.protectionSpace.serverTrust {
            credential = URLCredential(trust: trust)
            disposition = .useCredential
        }
    } else if let onAuthentication …
Run Code Online (Sandbox Code Playgroud)

ios swift urlsession urlsessiontask

9
推荐指数
0
解决办法
8931
查看次数

shouldAutorotate,supportedInterfaceOrientations和preferredInterfaceOrientationForPresentation在iOS 7中无法正常工作

我在尝试阻止某些视图中的方向时遇到问题,但代码不是工作属性.

我在每个视图中使用这些行:

- (BOOL)shouldAutorotate
{
    return YES;
}

- (NSUInteger)supportedInterfaceOrientations
{
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        return UIInterfaceOrientationMaskPortrait;
    } else {
        return UIInterfaceOrientationMaskAll;
    }
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationPortrait;
}
Run Code Online (Sandbox Code Playgroud)

它几乎可以在使用UINavigationController的视图中工作,但是在使用UITabBarController的视图中我遇到了很大的问题,因为它接触到的代码没有被调用.

uitabbarcontroller uinavigationcontroller ios7

8
推荐指数
1
解决办法
7878
查看次数

尝试从Eclipse到Android Studio执行Android App的异常

我尝试将Eclipse Android项目迁移到Android Studio,我尝试了两种方法,直接从Android Studio打开并首先迁移到Eclipse中的Gradle,然后在Android Studio中打开它.

然后我尝试删除Google Play库文件夹并将其添加到我的Gradle文件中,然后项目执行此操作:

  • 让项目
  • 清理项目确定
  • 重建项目 确定
  • Gradle同步并下载了很多DLL OK
  • 播放或调试KO并给我这个错误:

错误:任务执行失败':goSmart.guestperience.MoncloaDeSanLazaro:dexDebug'.

com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:进程'command'/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java''完成非零退出值2

要么

错误:任务执行失败':goSmart.guestperience.MoncloaDeSanLazaro:dexDebug'.

com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:进程'命令'/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java''完成非零退出值2

要么

错误:任务执行失败':goSmart.guestperience.MoncloaDeSanLazaro:dexDebug'.

com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:处理'命令'/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin/java''完成非零退出值2

我已经开始使用JDK 1.6,然后更新到1.7然后更新到1.8以查看是否存在问题.

如果我不删除Google Play Dervices文件夹,该项目就可以正常运行.

如果这很重要,我正在使用MAC.

如果要解决这个问题,我在堆栈溢出中发布的项目中遇到另一个问题.

这就是我的项目结构:

在此输入图像描述

这是所有项目的build.grade文件

主要的经营项目(客户经验1.0.1 Moncloa De San Lazaro):

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.0'
    }
}
Run Code Online (Sandbox Code Playgroud)

goSmart.guestperience.MoncloaDeSanLazaro(这是我编码的地方):

apply plugin: 'com.android.application'

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile project(':librarySmartHotel')
    compile …
Run Code Online (Sandbox Code Playgroud)

java eclipse android gradle android-studio

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

无法找到或生成匹配的歌唱资产Xcode 7.2.1

我刚刚重启了我的Mac,我在尝试验证或上传到de Apple Store时出现此错误.

无法找到或生成匹配的签名资产:

Xcode尝试查找或生成匹配的签名资产,但由于以下问题而无法执行此操作:

缺少xxxxxx Xcode的iOS分发签名身份可以请求一个.

在此输入图像描述

我已经尝试过很多来自Stackoverflow的东西,但没有任何工作.

我怎么能告诉Xcode再次请求它?我已经去了prefferencens并点击了"重置","全部下载",我已经删除了de account再次登录.

任何帮助将不胜感激.

xcode ios

5
推荐指数
1
解决办法
6820
查看次数

CGPathCreateCopyByTransformingPath到Swift 3

我是Swift 3的新手,我正在尝试将该函数转换为Swift 3:

- (void) drawRect: (CGRect)rect
{
    if (self.editionMode == Zoom) {

        for (Area *area in self.mArrayPaths) {

            CGAffineTransform zoom = CGAffineTransformMakeScale(self.scale, self.scale);

            CGPathRef movedPath = CGPathCreateCopyByTransformingPath([area.pathArea CGPath],                                                         &zoom);
            area.pathAreaTransformed = [UIBezierPath bezierPathWithCGPath:movedPath];


            [area.fillColor setFill];
            [area.strokeColor setStroke];

            [area.pathAreaTransformed fill];
            [area.pathAreaTransformed stroke];
        }
    }
    else if (self.editionMode == MoveShapes) {

        [self.currentArea.fillColor setFill];
        [self.currentArea.pathAreaShift fill];
        [self.currentArea.pathAreaShift stroke];

        for (Area *area in self.mArrayPaths) {

            if (area == self.currentArea) {

                continue;
            }

            [area.fillColor setFill];
            [area.strokeColor setStroke];

            [area.pathArea fill];
            [area.pathArea stroke];
        }

    } else …
Run Code Online (Sandbox Code Playgroud)

objective-c cgpath ios swift swift3

4
推荐指数
1
解决办法
1123
查看次数

从复杂的NSString中提取日期

我没有Xcode的能力来解决这个问题:

我有这个文字:

"402 Garcia 01/08/15 10:26 Observacionesdelhuésped"

我想提取我确定GMT + 0的日期,然后添加手机GMT例如GMT +1并将旧日期替换为NSString中的新日期.

GMT的东西,我刚刚在另一个地方解决它,所以我只需要提取并将日期字符串替换为字符串,所以我的最终结果将是这样的:

"402 Garcia 01/08/15 11:26 Observacionesdelhuésped"

任何帮助将不胜感激,并提前感谢.

string date objective-c nsstring ios

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

无法将Android Studio与Maven存储库同步

我正在尝试将此库添加到我的项目中:

但是Android Studio返回此错误:

错误:(8,13)无法解决:com.github.castorflex.smoothprogressbar:library:1.1.0

错误:(6,13)无法解决:com.loopj.android:android-async-http:1.4.6

错误:(7,13)无法解决:com.google.apis:google-api-services-analytics:v3-rev115-1.20.0

这是我的build.grade文件:

apply plugin: 'com.android.application'


dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile project(':librarySmartHotel')
    compile 'com.loopj.android:android-async-http:1.4.6'
    compile 'com.google.apis:google-api-services-analytics:v3-rev115-1.20.0'
    compile 'com.github.castorflex.smoothprogressbar:library:1.1.0'
    compile 'com.google.android.gms:play-services:6.5.87'
}

android {
    compileSdkVersion 19
    buildToolsVersion "22.0.1"

    defaultConfig {
        multiDexEnabled true
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        // Move the tests to tests/java, tests/res, etc...
        instrumentTest.setRoot('tests')

        // Move the build …
Run Code Online (Sandbox Code Playgroud)

java android gradle maven android-studio

0
推荐指数
1
解决办法
560
查看次数