小编mob*_*bob的帖子

为什么我的UIActivityIndi​​catorView不会停止动画?

我正在尝试从我的App Delegate管理活动指示器,这样我的任何视图都可以将指示器调高.所以,我将它作为子视图添加到'window'并按如下方式启动/停止:

- (void)didStartActivity
{
    if( activityIndicator == nil ) {
        activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
        activityIndicator.hidesWhenStopped = YES;
        activityIndicator.center = window.center;
        activityIndicator.transform = CGAffineTransformScale(CGAffineTransformIdentity, 6.0, 6.0);
    }
    NSLog(@"%s: starting the activityIndicator", __FUNCTION__);
    [window addSubview:activityIndicator];
    [activityIndicator startAnimating];
}
Run Code Online (Sandbox Code Playgroud)

我看到日志消息,所以我知道正在调用代码.指标位于中心,默认大小为6倍.但是,stopAnimating并没有停止.我唯一能得出的结论是它需要在当前的视图控制器中运行.

- (void)didStopActivity
{
    NSLog(@"%s: stopping the activityIndicator", __FUNCTION__);
    [activityIndicator stopAnimating];
    [activityIndicator removeFromSuperview];
}
Run Code Online (Sandbox Code Playgroud)

iphone cocoa-touch uikit uiactivityindicatorview

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

我的UITabBarController的didSelectViewController方法没有被调用?

这是我的app-delegate.m的代码存根 - 它永远不会被调用.

- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {
    NSLog(@"%s", __FUNCTION__);
}
Run Code Online (Sandbox Code Playgroud)

它在app-delegate.h中定义

@interface OrioleAppDelegate : NSObject <UIApplicationDelegate, UITabBarControllerDelegate> {
    UIWindow *window;
    UITabBarController *tabBarController;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UITabBarController *tabBarController;

@end
Run Code Online (Sandbox Code Playgroud)

iphone cocoa-touch callback uitabbarcontroller

3
推荐指数
2
解决办法
9659
查看次数

为什么parcelable对象在接收活动时为null?

我正在遵循Android开发人员指南中的Parcelable示例,目的是让我发送一个更复杂的对象发送给不同的活动.现在,我的类是String成员的包装器.如果我将对象放在intent中并从Intent读取它,它会按预期读取,但是,在接收器端,它始终是空指针.

我的课:

package com.mobibob.android.myapp;

import android.os.Parcel;
import android.os.Parcelable;


public class ContentItem implements Parcelable {
    public String name = "name";
    public static final String EXTRA_CONTENT_DETAIL = "contentDetail";

    ContentItem(String n) {
        name = n;
    }

    ContentItem(Parcel in) {
            in.readParcelable(ContentItem.class.getClassLoader());  <--- NEW CODE
        name = in.readString();
    }

    @Override
    public String toString() {
        return name.toString();
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(name);
    }

    public final Parcelable.Creator<ContentItem> CREATOR = new Parcelable.Creator<ContentItem>() {
        public ContentItem …
Run Code Online (Sandbox Code Playgroud)

android parcelable android-intent

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

如何获得Android sdcard上的可用空间?

我使用Environment.getExternalStorageDirectory()来创建一个文件,我需要知道在创建和存储文件之前是否有足够的可用空间.

如果你能引用Android Ref文档,那也会有所帮助.

environment android sd-card

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

是否可以通过不抛出异常的基类的调用方法抛出java异常?

这可能是一个关于异常处理的荒谬的Java问题,但我有一个UI actor(一个Android Activity),它从我的ContentProvider子类请求服务.当sd-card已满,sd-card缺失,网络i/o错误等时,子类想要抛出一些异常.但是,当我编写CP子类来抛出异常时,编译器提供添加异常CP班.显然,我不想修改基类,但我希望UI能够捕获子类的异常.

合理?这可能吗?如果没有,我的服务子类是否有更好的模式将其throwable对象返回到UI?

java subclass throwable

3
推荐指数
2
解决办法
786
查看次数

在Mac OS环境中为JAVA_HOME指定了什么路径?

当应用程序或插件安装声明JAVA_HOME变量指向我的JDK时,我需要将哪个导出语句放入我的.bash_profile中?

java macos plugins java-home

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

如何在iPhone/XCode中定义静态字符串表?

在开发自定义手势时,我想要一个调试/跟踪消息的状态名表.这个声明及其用法有什么问题?

static NSDictionary *dictStateNames = nil;

@implementation MyCustomGesture


@synthesize state;

+(void)initStateNames {
    if (dictStateNames == nil) {
        dictStateNames = [NSDictionary dictionaryWithObjectsAndKeys:
                          @"StateBegan", [NSNumber numberWithInt:UIGestureRecognizerStateBegan],
                          @"StateCancelled", [NSNumber numberWithInt:UIGestureRecognizerStateCancelled],
                          @"StateChanged", [NSNumber numberWithInt:UIGestureRecognizerStateChanged],
                          @"StateEnded", [NSNumber numberWithInt:UIGestureRecognizerStateEnded],
                          @"StateFailed", [NSNumber numberWithInt:UIGestureRecognizerStateFailed],
                          @"StatePossible", [NSNumber numberWithInt:UIGestureRecognizerStatePossible],
                          @"StateRecognized", [NSNumber numberWithInt:UIGestureRecognizerStateRecognized],
                          nil];
    }
}

-(id) init {
    self = [super init];
    if (self) {
        [MyCustomGesture initStateNames];
        state = UIGestureRecognizerStatePossible;
    }
    return self;
}

-(id) initWithTarget:(id)target action:(SEL)action {
    self = [super initWithTarget:target action:action];
    if (self) {
        [MyCustomGesture initStateNames];
        state = …
Run Code Online (Sandbox Code Playgroud)

iphone xcode static nsdictionary

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

存储在iphone仿真器上的sqlite3数据库在哪里?

既然我有一个只读应用程序,我正在处理insert语句.插入在我的代码中返回OK,但是回读(在代码中)显示为空,所以我想使用命令行或浏览器来读取.我可以将数据库从仿真器复制到我的笔记本电脑中以便与其他实用程序一起访问吗?

sqlite iphone emulation

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

Android appWidget允许Toast吗?

我想从appwidget弹出一个错误,当它的后台任务之一失败,但我不认为这是允许的 - 或者,如果它的工作原理,它是安全的.

android toast android-appwidget

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

使用iPad2 ad-hoc发行版进行beta测试的后勤步骤是什么?

我理解这些原则,但我需要一些额外的帮助来完成具体的步骤.我有ad-hoc的配置文件,现在我想告诉测试版测试人员"给我发送他们iPad2的UDID,我将通过电子邮件发送我可以通过iTunes安装在iPad2上的应用程序副本".有些测试人员的地理位置很远,所以我不能做任何系留iPad2设备配置或准备工作.是否可以列出步骤?

像这样简单:

  1. 切割n'将测试者的UDID粘贴到.... XCode Organizer或Dev Portal中
  2. 单击使用UDID的新配置证书删除应用程序
  3. 将zapped应用程序和证书通过电子邮件发送给测试人员
  4. 测试人员下载电子邮件附件
  5. 测试仪打开iTunes并发现下载的应用程序并将其同步到iPad2

ad-hoc-distribution ios

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

iPad:呈现模态视图,我的parentViewController现在为零?

我有几个模态视图一直工作"很好",现在停止返回到父视图控制器,"代码没有改变." - 经典问题描述.

我调试了模态视图解除,父视图控制器是nil,这解释了问题,但不是原因.我确实将我的SDK从4.1.2升级到4.2,所以我可以开始使用iOS 5.我怀疑新的内存管理ARC和我的自动释放风格与保留/释放.

以下是我的rootview控制器到AboutViewController的代码:

- (IBAction)doInfo:(id)sender {
    NSLog(@"%s", __FUNCTION__);
    AboutViewController *aboutViewController = [[[AboutViewController alloc] initWithNibName:@"AboutViewController" bundle:[NSBundle mainBundle]] autorelease];
    if (aboutViewController) {
        aboutViewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
        aboutViewController.hidesBottomBarWhenPushed = YES;
        self.navigationController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
        self.navigationController.navigationBarHidden = YES;
        [self presentModalViewController:aboutViewController animated:YES];
    }
}
Run Code Online (Sandbox Code Playgroud)

以下是在按下"完成"按钮后将AboutViewController中的消除回到其父节点.

- (IBAction)doDone:(id)sender {
    NSLog(@"%s", __FUNCTION__);
    [[self parentViewController] dismissModalViewControllerAnimated:YES];
}
Run Code Online (Sandbox Code Playgroud)

好的......我修改如下修改.现在的问题是为什么以前这项工作?

- (IBAction)doDone:(id)sender {
    NSLog(@"%s", __FUNCTION__);
    [self dismissModalViewControllerAnimated:YES];
}
Run Code Online (Sandbox Code Playgroud)

parentviewcontroller ipad presentmodalviewcontroller

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

如何确定svn工作副本是来自分支还是主干?

我的项目有标准的主干/标签/分支结构,通常在主干中工作.在假期之前,我切换到分支机构做了一个孤立的改变,如果我换回主干,现在我已经失去了召回.有没有办法检查我的本地工作副本是否与分支或主干相对应?

我想开始为即将发布的版本做出更多更改,当我在一天结束时提交时,我不想提交分支,我也不准备合并分支.

svn branch svn-trunk

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

如何让android图标改变状态(突出显示)?

我在小部件中使用Android SDK图标按钮进行刷新(ic_menu_refresh),我需要在按下时更改选择状态.这是怎么做到的?我是否为按钮定义了XML?

icons android android-widget standard-icons

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