小编dav*_*ara的帖子

x秒后关闭Twitter Bootbox

是否可以在10秒后关闭Twitter启动箱?!我这样打开它:

bootbox.confirm("{{$steps[0]}}","accept","decline" ,function(result) {
    if (result) {

    }
}); 
Run Code Online (Sandbox Code Playgroud)

javascript jquery twitter-bootstrap bootbox

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

从Documents到NSData的文件

我想从文档目录中获取一个文件到一个NSData对象,但如果我这样做,我NSData总是NIL:

filepath = [[NSString alloc] init];
filepath = [self.GetDocumentDirectory stringByAppendingPathComponent:fileNameUpload];
NSData *data = [[NSFileManager defaultManager] contentsAtPath:filepath];

-(NSString *)GetDocumentDirectory{
fileMgr = [NSFileManager defaultManager];
homeDir = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];

return homeDir;
Run Code Online (Sandbox Code Playgroud)

}

在这一点上,我总是得到一个例外,我的数据是NIL:

[request addRequestHeader:@"Md5Hash" value:[data MD5]];
Run Code Online (Sandbox Code Playgroud)

我检查过,没有文件,但我不知道为什么!我之前创建了该文件:

NSMutableString *xml = [[NSMutableString alloc] initWithString:[xmlWriter toString]];

NSArray *paths = NSSearchPathForDirectoriesInDomains
(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];

//make a file name to write the data to using the documents directory:
NSMutableString *fileName = [NSMutableString stringWithFormat:@"%@/7-speed-", …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c

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

iOS 7故事板本地化与归属标签

我使用ibtool从我的Base Storyboard为我的所有语言生成我的String- Files ...出于某种原因,ibtool没有提取UILabel带有"属性"的样式的s ...

我没有那些标签的键/值对...有人知道为什么?!

iphone localization objective-c storyboard ios7

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

Android GridView多选

我有一个GridView实现并激活了

mGridView.setChoiceMode(GridView.CHOICE_MODE_MULTIPLE_MODAL);
Run Code Online (Sandbox Code Playgroud)

模式.现在,当我对一个项目执行长按时,我可以从网格中选择多个项目.我希望通过正常的短按实现此行为.这可能吗?

android gridview android-listview android-gridview

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

MonoTouch应用程序到Mono Android

我是Mono的新手,我的第一个问题是,如果可以在Monotouch中创建一个应用程序,然后为iOS,Android和Windows Phone构建它?我的意思是,我可以有一个源代码吗?!

.net mono xamarin.ios windows-phone-7 xamarin.android

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

如何在启动箱关闭之前显示剩余的秒数?

我的twitter BootBox打开如下:

bootbox.dialog("{{$steps[0]}}"); 
Run Code Online (Sandbox Code Playgroud)

十秒后,我关闭我的BootBox,如下所示:

window.setTimeout(function(){
    bootbox.hideAll();
}, 10000);
Run Code Online (Sandbox Code Playgroud)

是否有可能在BootBox中显示剩余的秒数直到关闭?

javascript jquery twitter-bootstrap bootbox

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

没有Apple Server的Apple推送通知

是否有可能在不使用Apple的服务器的情况下向iOS客户端发送推送通知?!

而另一方面,是否可以推送整个文件?!比如XML文件,或者你可以只是推送短信?!

另一个问题,有没有办法将xml文件远程推送到iOS客户端?!

objective-c push-notification apple-push-notifications ios ios7

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

CABasicAnimation Position.Y

我只想用这个函数为我的UIButton的位置设置动画:

CABasicAnimation *moveUp;
    moveUp          = [CABasicAnimation animationWithKeyPath:@"position.y"];
    moveUp.fromValue = [NSNumber numberWithFloat:self.retestBTN.frame.origin.y];
    moveUp.toValue  = [NSNumber numberWithFloat:self.retestBTN.frame.origin.y - 50];
    moveUp.duration = 1.0;
    moveUp.removedOnCompletion = NO;
    moveUp.fillMode = kCAFillModeBoth;
    moveUp.delegate = self;
    [[retestBTN layer] addAnimation:moveUp forKey:@"y"];
Run Code Online (Sandbox Code Playgroud)

然后我想在那个时候使用该函数为它设置动画:

CABasicAnimation *moveDown;
moveDown            = [CABasicAnimation animationWithKeyPath:@"position.y"];
moveDown.fromValue  = [NSNumber numberWithFloat:self.retestBTN.frame.origin.y];
moveDown.toValue    = [NSNumber numberWithFloat:self.retestBTN.frame.origin.y + 50];
moveDown.duration   = 1.0;
moveDown.removedOnCompletion = NO;
moveDown.fillMode   = kCAFillModeForwards;
[[retestBTN layer] addAnimation:moveDown forKey:@"y"];
Run Code Online (Sandbox Code Playgroud)

但这不能正常工作,我的UIButton走向了奇怪的位置......

iphone objective-c

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

CoreTelephony框架iOS 7

iOS 7中的CoreTelephony框架中是否有更多允许更多的更改?!我在这里找到了新的Headerfiles:

https://github.com/EthanArbuckle/IOS-7-Headers/tree/master/Frameworks/CoreTelephony.framework

那么,这是否意味着现在允许使用这些方法?!还是他们还是私人的?!

iphone ios ios7

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

检测USB连接并检查它是否是PC

我想检测我的Android手机是否通过USB连接...为此我使用此代码:

public static boolean isConnected(Context context) {
    intent = context.registerReceiver(null, new IntentFilter("android.hardware.usb.action.USB_STATE"));
    return intent.getExtras().getBoolean("connected");
}
Run Code Online (Sandbox Code Playgroud)

但有没有可能明确知道我是否连接到PC?!因为即使我将手机连接到打印机,或者使用USB端口连接其他解决方案,我已经触发了事件...

我已经尝试过刚刚发布的解决方案@nios,但是如果isCharging和usbCharge布尔值被设置为true,则不能保证你连接到PC ......即使你连接到打印机,两个布尔都会打赌设置为真的......那就是我的问题

java usb android android-intent

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

从另一个类更新UI

我试图分离我的GUI和我的逻辑...例如,我有一个计算某事的类(calc.h/calc.m).我有我的GUI(viewController.h/viewController.m)...现在我想从另一个类更新GUI的一个元素...我已经尝试使用Singleton,如下所示:

calc.m:

viewController *con = [viewController sharedInstance];
con.download.text = @"It Works";

viewController.m:

+ (id)sharedInstance {
static id sharedInstance;
@synchronized(self) {
    if (!sharedInstance)
        sharedInstance = [[viewController alloc] init];
    return sharedInstance;
}
}
Run Code Online (Sandbox Code Playgroud)

但它不起作用......

更新:

在我的ViewController中:

[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(receiveNotification:)
                                             name:@"UpdateDownloadLabel"
                                           object:nil];

- (void) receiveNotification:(NSNotification *) notification
{

NSDictionary* userInfo = notification.userInfo;

if ([[notification name] isEqualToString:@"Update"])
{
    download.text = [userInfo valueForKey:@"Test"];
}
}
Run Code Online (Sandbox Code Playgroud)

在我的其他课程中,我发布了这样的通知:

[[NSNotificationCenter defaultCenter]
 postNotificationName:@"UpdateDownloadLabel"
 object:nil userInfo:info];
Run Code Online (Sandbox Code Playgroud)

但它不起作用......

iphone objective-c ios ios7

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