小编Jas*_*man的帖子

一个大的javascript文件或多个较小的文件?

好吧,所以我有一个合理的大小项目,我正在使用jquery主干和其他几个javascript库.我想知道我的javascript库是否应该有一个文件而我的自定义代码应该有另一个文件.或者一堆单独的javascript文件.

javascript performance jquery web

45
推荐指数
4
解决办法
5万
查看次数

如果将UIView添加为子视图,则UIButton目标不起作用

我有一个UIButton.它有两个子视图.然后我打电话给:

[createButton addTarget:self action:@selector(openComposer) forControlEvents:UIControlEventTouchUpInside];
Run Code Online (Sandbox Code Playgroud)

如果我点击UIButton那些未被覆盖的部分,但是它的一个子视图,它可以正常工作.但是,如果我点击其中一个子视图,则不会触发该操作.

在两个子视图中,我已经.userInteractionEnabled设置为YES.

这两个子视图都是UIViews带有frame和的backgroundColor.

如何让水龙头"通过" UIView并进入UIButton

谢谢

编辑:我需要使用UIControlEvents因为我需要UIControlEventTouchDown.

编辑2:

这是按钮的代码.

@interface CreateButton ()

@property (nonatomic) Theme *theme;
@property (nonatomic) UIView *verticle;
@property (nonatomic) UIView *horizontal;
@property (nonatomic) BOOL mini;

@end

@implementation CreateButton

#pragma mark - Accessors

- (UIView *)verticle {
    if (! _verticle) {
        _verticle = [[UIView alloc] init];
        _verticle.backgroundColor = [self.theme colorForKey:@"createButtonPlusBackgroundColor"];
        _verticle.userInteractionEnabled = NO;
    }
    return …
Run Code Online (Sandbox Code Playgroud)

objective-c uibutton uiview ios

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

容器视图在completeTransition上消失:

我正在使用自定义视图控制器转换UIViewControllerAnimatedTransitioning,以显示和关闭视图控制器.

呈现动画效果很好,但是当我运行dismiss动画时,一旦我调用completeTransition:containerView被删除的动画.

我不确定发生了什么,这里是转换代码:

- (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext {
    UIViewController *fromViewController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
    UIViewController *toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];

    UIView *containerView = [transitionContext containerView];
    containerView.backgroundColor = [UIColor blackColor];

    if (self.reverse) {
        [containerView addSubview:toViewController.view];
        [containerView addSubview:fromViewController.view];
    } else {
        [containerView addSubview:fromViewController.view];
        [containerView addSubview:toViewController.view];
    }

    if (! self.reverse) { // Forward
        toViewController.view.frame = CGRectMake(-containerView.frame.size.width, 0, containerView.frame.size.width, containerView.frame.size.height);
    } else {
        fromViewController.view.frame = CGRectMake(0, 0, containerView.frame.size.width, containerView.frame.size.height);
    }

    [UIView animateWithDuration:[self transitionDuration:transitionContext] delay:0 usingSpringWithDamping:0.75f initialSpringVelocity:1.0f options:UIViewAnimationOptionCurveLinear animations:^{
        if (self.reverse) {
            fromViewController.view.frame …
Run Code Online (Sandbox Code Playgroud)

objective-c uiviewcontroller uiview uiviewanimationtransition ios

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

如何使用特定于用户的密钥创建双向编码/解码方法 - PHP?

我需要两个函数/方法,一个用于编码,一个用于解码.这不是用于存储密码.每个用户都有一个特定的密钥/盐来编码数据.

这就是我希望它的工作方式:

function encode($str, $key) {
    // something fancy
}

function decode($str, $key) {
    // something fancy
}

$key = $logged_in_user->get_key();
$plain = 'abc abc 123 123';
$encoded_data = encode($plain, $key);
// some_fancy_encrypted_data_that_is_really_cooooool
$decoded_data = decode($encoded_data, $key);
// abc abc 123 123
Run Code Online (Sandbox Code Playgroud)

另一件事是每次我使用这个函数时,每次我使用encode具有相同用户密钥的函数时,它都需要返回相同的东西.

我该怎么办?

php encryption encode salt

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

APNS:无效令牌(8)

我正在使用https://code.google.com/p/apns-php/上提供的apns php服务器.

我已经设置了推送通知证书但我的代码仍然在连接时抛出错误.

这有什么问题?以下是我获取设备令牌的方法:

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken {

#if !TARGET_IPHONE_SIMULATOR

    // Prepare the Device Token for Registration (remove spaces and < >)
    NSString *deviceToken = [[[[devToken description]
                               stringByReplacingOccurrencesOfString:@"<"withString:@""]
                              stringByReplacingOccurrencesOfString:@">" withString:@""]
                             stringByReplacingOccurrencesOfString: @" " withString: @""];
    NSLog(@"%@", deviceToken);

#endif
}
Run Code Online (Sandbox Code Playgroud)

这是我运行服务器时的错误:

Sat, 11 May 2013 13:37:53 -0700 ApnsPHP[18198]: INFO: Trying 
ssl://gateway.push.apple.com:2195...
Sat, 11 May 2013 13:37:54 -0700 ApnsPHP[18198]: INFO: Connected to ssl://gateway.push.apple.com:2195.
Sat, 11 May 2013 13:37:54 -0700 ApnsPHP[18198]: INFO: Sending messages queue, run #1: 1 message(s) …
Run Code Online (Sandbox Code Playgroud)

php objective-c push-notification apple-push-notifications apns-php

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

一旦渲染,就更新NSTextAttachment的图像

我有一个NSTextAttachment,我想显示一个加载图像,直到图像下载,然后一旦它我想要更新图像.

我有所有的逻辑,除非我textAttachment.image = image第二次打电话没有任何反应.

如何更新NSTextAttachment已经由UITextView?呈现的?

谢谢!

uitextview uiimage nstextattachment

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

如何在不使用UIImagePickerController的情况下使用内置的iOS摄像头

我想在我的应用程序中创建自己的UI图片.这可能吗?我见过很多应用程序都使用这个功能(其他相机应用程序)有自定义用户界面,拍完照片后它不会询问你是否要重拍照片.如果不翻转用前置摄像头拍摄的照片也会很好.那我该怎么做?

谢谢

user-interface camera objective-c uiimagepickercontroller ios

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

iOS:如何判断应用程序何时暂停?

我想知道我的应用何时暂停?在一定时间内未被激活或被用户终止的状态.我需要这个,因为我需要关闭一个Web套接字的连接.我想在应用程序处于后台状态时保持连接处于活动状态.

我该怎么做呢?

谢谢

编辑:这不是一个重复的问题,其他问题是关于应用程序不再活动时,我想知道该应用程序已被终止.

background objective-c suspend application-state ios

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

如何使用全屏图像ios创建自定义UIImagePickerController

我有一个简单的UIImagePickerController,它将使用相机拍照,但有几件事我希望它做:

  • 拥有自定义相机UI
  • 全屏而不是480x640(如果是4英寸手机)

这是我显示UIImagePickerController的代码:

- (IBAction)pick:(id)sender {
    NSLog(@"abc");
    picker = [[UIImagePickerController alloc] init];
    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
        [picker setSourceType:UIImagePickerControllerSourceTypeCamera];
    } else {
        [picker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
    }
    [picker setDelegate:self];
    [self presentViewController:picker animated:YES completion:nil];

}
Run Code Online (Sandbox Code Playgroud)

这是为了拍摄图像时:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    [self dismissViewControllerAnimated:YES completion:nil];
    UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
    [imageView setImage:image];
}
Run Code Online (Sandbox Code Playgroud)

我该怎么做呢?

谢谢

uiimageview uiimagepickercontroller ios

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

设置Google Domains DNS以使用Mailgun MX Records

我正在尝试使用Mailgun在我的电子邮件的子域中接收电子邮件.喜欢hi@bob.stage.example.com.我按照Mailgun的指示添加了MX记录,但我无法完全验证它.MX记录保持橙色,带有"!".

我将Google Apps用于主域example.com,但不适用于任何子域.

您认为我可以做些什么来让Google Domains和Mailgun就MX记录的使用达成一致?

dns mailgun

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