小编rog*_*rog的帖子

在使用http-mock的Ember CLI应用程序中配置CSP

我正在http://www.ember-cli.com/#ember-data上建议使用带有Ember CLI的http-mock .我理解CSP的基本概念,但我不了解它在Ember CLI应用程序中的配置.

如何配置我的应用程序以接受请求以localhost:4200/api/在开发期间避免这种情况:

Content Security Policy violation: {
    "csp-report": {
        "document-uri":"http://localhost:4200/products",
        "referrer":"",
        "violated-directive":"style-src 'self'",
        "effective-directive":"style-src",
        "original-policy":"default-src 'none'; script-src 'self' 'unsafe-eval' localhost:35729 0.0.0.0:35729; font-src 'self'; connect-src 'self' ws://localhost:35729 ws://0.0.0.0:35729 http://0.0.0.0:4200/csp-report; img-src 'self'; style-src 'self'; media-src 'self'; report-uri http://0.0.0.0:4200/csp-report;",
        "blocked-uri":"",
        "source-file":"chrome-extension://alelhddbbhepgpmgidjdcjakblofbmce",
        "line-number":1,"column-number":20481,"status-code":200
    }
}
Run Code Online (Sandbox Code Playgroud)

ember.js ember-cli http-mock

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

如何在应用程序中启用iOS 6.0全景相机?

我正在开发一款使用相机的iOS 6应用程序,但我一直无法弄清楚如何启用允许用户拍摄全景照片的选项.拍摄普通照片时,我已经完成了所有工作,但是想让用户选择在应用程序中使用iOS 6中的新全景功能.

我已经搜索过网络,但却无法找到任何信息(例如,Apple开发中心等).我无法确定这是否是可能的.我们可以使用它,如果是这样,怎么样?

iphone uiimagepickercontroller ios ios6

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

UICollectionView滚动很慢

我刚刚创建了一个UICollectionView用户可以将手机中的图像添加到应用程序中的相册功能中.我将图像保存到文档目录中的子目录中,因此可以添加和删除更多图像.但是,当我在集合视图中向上和向下滚动时,它非常迟钝.

如何使滚动变得美观和流畅?

我的代码:前16个图像是预设图像,之后的所有内容都来自文档目录中的子目录

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    CollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"Custom" forIndexPath:indexPath];
    //Current index number
    int index=indexPath.section * noOfSection + indexPath.row;
    //Check if its the preset photos
    if(index<16){
        NSString *name=[recipePhotos objectAtIndex:indexPath.section * noOfSection + indexPath.row];
        cell.imageView.image=[UIImage imageNamed:name];
    }

//not preset photos, so retrieve the photos the user added
    else {
        NSData *data= [NSData dataWithContentsOfFile:[recipePhotos objectAtIndex:index]];
        UIImage *theImage=[UIImage imageWithData:data];

        cell.imageView.image=theImage;
        data=nil;
    }

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

Time Profiler给了我这个

Running Time    Self        Symbol Name
568.0ms   63.1% 0.0 …
Run Code Online (Sandbox Code Playgroud)

scroll ios uicollectionview

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

在子文件夹中组织Ember.js模型?

我有多个表示用户数据的模型(配置文件,设置等).目前这些都存储在models文件夹中,就像这样;

models
  -> user.js
  -> profile.js
  -> settings.js
Run Code Online (Sandbox Code Playgroud)

我想要的是这样的文件夹结构;

models
  -> user.js
  -> user (folder)
    -> profile.js
    -> settings.js
Run Code Online (Sandbox Code Playgroud)

用户模型(user.js)像这样引用配置文件模型(profile.js);

import DS from "ember-data"; 
export default DS.Model.extend({
   NSP: DS.attr('string'),
   Status: DS.attr('string'),
   Profile: DS.belongsTo('profile', {embedded: 'always'})
});
Run Code Online (Sandbox Code Playgroud)

我试图DS.belongsTo('profile', {embedded: 'always'})用以下内容替换:

  • DS.belongsTo('user.profile', {embedded: 'always'})
  • DS.belongsTo('user/profile', {embedded: 'always'})
  • DS.belongsTo('user-profile', {embedded: 'always'})

但这不起作用.

我在这里错过了什么吗?

ember.js ember-cli

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

相机叠加图片

编辑3

好消息和坏消息.好消息是,在Connections Inspector中,通过断开覆盖UIToolbar并连接UIImageview,我看到了theKing,但是 - 坏消息 - 我没有看到UIToolbar,我也需要它.所以现在的问题是,用户如何在他/她完成时回到调用VC?如何将工具栏和图像都作为叠加层的一部分,或者"返回按钮"工具栏是否可以位于非叠加视图上,或者某些东西?或者如何在OverlayViewController上同时显示工具栏和图像?

编辑3

编辑2

setupImagePickerOverlayViewController.m.

- (void)setupImagePicker:(UIImagePickerControllerSourceType)sourceType
{
    self.imagePickerController.sourceType = sourceType;

    if (sourceType == UIImagePickerControllerSourceTypeCamera)
    {
        // user wants to use the camera interface
        //
        self.imagePickerController.showsCameraControls = NO;

        if ([[self.imagePickerController.cameraOverlayView subviews] count] == 0)
        {
            // setup our custom overlay view for the camera
            //
            // ensure that our custom view's frame fits within the parent frame
            CGRect overlayViewFrame = self.imagePickerController.cameraOverlayView.frame;
            CGRect newFrame = CGRectMake(0.0,
                                         CGRectGetHeight(overlayViewFrame) -
                                         self.view.frame.size.height - 10.0, …
Run Code Online (Sandbox Code Playgroud)

iphone xcode uiimagepickercontroller ios

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

MFMailComposeViewController强制图像附件的实际大小

我正在开发一个应用程序,允许用户使用MFMailComposeViewController通过电子邮件发送图像.附加的图像是1200 x 1800,图像大小必须不变.

对于大图像,MFMailComposeViewController为用户提供一个操作表,让他们可以选择在按下"发送"时缩小图像(参见屏幕截图).我希望不显示此操作表,并强制附加图像的实际大小.

任何建议赞赏!

截图

cocoa-touch ios mfmailcomposeviewcontroller

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

使用MPMoviePlayerController和锁定屏幕继续播放声音?

当您观看视频MPMoviePlayerController并且用户按下顶部按钮以锁定屏幕时,应用程序将进入睡眠状态,视频中的声音也会进入休眠状态.

有没有办法阻止锁定停止声音?如果没有,有没有办法拦截锁定,创建一个"自定义锁定",以节省一些电池,但继续播放视频?

iphone audio objective-c core-audio mpmovieplayercontroller

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

实现共享作为功能的标准方法

我需要在iOS中实现"share as ..."功能.例如,按钮将"共享为..."命名并弹出一个对话框,其中包括电子邮件,短信,Facebook,Twitter等项目.我想知道是否有标准对话框可以完成这项工作.

share ios

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

iOS相机定制:如何实现网格线?

我可以使用闪光灯功能,访问照片库,并使用后/前相机.

我想实现在用户拍照时显示的网格线.

有任何想法吗?

iphone camera uiimagepickercontroller ios

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

将NSNumber转换为NSString并不是一个字符串

我有一个问题,将NSNumber值转换为NSString

MyPowerOnOrNot是一个NSNumber女巫只能返回1或0并且myStringNSString...

myString = [NSString stringWithFormat:@"%d", [myPowerOnOrNot stringValue]];

NSLog(@"%@",myString);
if(myString == @"1") {
    [tablearrayPOWERSTATUS addObject:[NSString stringWithFormat:@"%@",@"ON"]];
}
else if(myString == @"0") {
    [tablearrayPOWERSTATUS addObject:[NSString stringWithFormat:@"%@",@"OFF"]];
}
Run Code Online (Sandbox Code Playgroud)

这有什么问题?

NSLog节目0或控制台作为串1,但是我不能检查,如果它是1或0的if语句?

如果不实际应该跳到语句中......我真的不明白为什么这不起作用..任何帮助都会非常好!

objective-c nsnumber

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

iOS模拟器是否能够模拟设备的相机?

为了确保我拥有正确的所有代码,这是我的头文件:

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController <UIImagePickerControllerDelegate,UINavigationControllerDelegate> {

    IBOutlet UIImageView *imageView;
    IBOutlet UIButton *choosePhoto;
    IBOutlet UIButton *takePhoto;

}

@property(nonatomic, retain) UIButton *choosePhoto;

@property(nonatomic, retain) UIButton *takePhoto;

@property(nonatomic, retain) UIImageView *imageView;

-(IBAction)getPhoto:(id)sender;
-(IBAction)takePhoto:(id)sender;

@end
Run Code Online (Sandbox Code Playgroud)

然后这是我的实现:

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

@synthesize imageView,choosePhoto,takePhoto;

- (void)viewDidLoad
{
    [super viewDidLoad];

}

-(IBAction)getPhoto:(id)sender {

    UIImagePickerController *picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;
    picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
    [self presentViewController:picker animated:YES completion:nil];
}

-(IBAction)takePhoto:(id)sender {

    UIImagePickerController *picker2 = [[UIImagePickerController alloc] init];
    picker2.delegate = …
Run Code Online (Sandbox Code Playgroud)

uiimagepickercontroller ipad ios-simulator ios6 xcode4.5

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

如何知道UITableView中Tableview单元格按钮上的节号?

我有一个UITableView,我已经为其创建了一个自定义的UITableViewCell.tableview中的每一行都有一个按钮.我想知道单击按钮时的节号,以便我知道单击了哪个部分按钮.我已经尝试过在堆栈上找到的一些东西,但没有任何工作.

UIButton *b = sender; 
NSIndexPath *path = [NSIndexPath indexPathForRow:b.tag inSection:0]; 
NSLog(@"Row %d - Section : %d", path.row, path.section);
Run Code Online (Sandbox Code Playgroud)

iphone uitableview ios

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