小编E-M*_*add的帖子

AVAssetImageGenerator提供旋转的图像

当通过AVAssetImageGenerator获取视频的UIImage时,当视频以纵向方向拍摄时,我会返回旋转的图像(技术上它们不是).如何判断视频的拍摄方向,然后正确旋转图像?

AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:url options:nil];
AVAssetImageGenerator *generate = [[AVAssetImageGenerator alloc] initWithAsset:asset];
NSError *err = NULL;
CMTime time = CMTimeMake(0, 60);
CGImageRef imgRef = [generate copyCGImageAtTime:time actualTime:NULL error:&err];
[generate release];
UIImage *currentImg = [[UIImage alloc] initWithCGImage:imgRef];
Run Code Online (Sandbox Code Playgroud)

iphone objective-c avfoundation ios

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

SQL Server从datetime中删除毫秒

select *
from table
where date > '2010-07-20 03:21:52'
Run Code Online (Sandbox Code Playgroud)

我希望不会给我任何结果...除了我得到一个日期时间为的记录 2010-07-20 03:21:52.577

如何使查询忽略毫秒?

t-sql sql-server

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

ViewController中的UINavigationController,视图顶部的间隙

我正在开发一个通用应用程序,我正试图在iPhone和iPad版本之间共享尽可能多的代码.我需要使用一个TabBarController作为我的根视图控制器,虽然我想每个选项卡的使用SplitViewController,SplitViewController的文档说,它需要的根视图控制器.因此,考虑到所有这些 - 了解我正在尝试并排放置两个导航控制器,并且(大部分)复制SplitViewController的行为/布局.

一切都很好,除了视图的布局.当应用程序以纵向模式启动时,一切都会在设备方向改变时正常运行并调整大小/位置.

纵向

如果应用程序以UIDeviceOrientationPortrait以外的任何方向启动,则视图将在导航控制器上方显示20点间隙/边距.我试过在运行时调整帧没有完美的结果.将框架的origin.y调整为-20并将高度增加20会使视图与其父级的顶部齐平,但在底部留下20个点的间隙!

景观取向

iphone xcode interface-builder ipad ios

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

CGContextSetFillColorWithColor:无效的上下文0x0

CGContextSetFillColorWithColor:无效的上下文0x0.这是一个严重的错误.该应用程序或其使用的库正在使用无效的上下文,从而导致系统稳定性和可靠性的整体降低.此通知是礼貌的:请解决此问题.它将成为即将到来的更新中的致命错误.

我从这个方法的[color setFill]行得到了错误.关于如何解决它的任何想法?

+ (UIImage *)fillImage:(UIImage*)image withColor:(UIColor *)color
{

    // begin a new image context, to draw our colored image onto
    UIGraphicsBeginImageContextWithOptions(image.size, NO, [[UIScreen mainScreen] scale]);

    // get a reference to that context we created
    CGContextRef context = UIGraphicsGetCurrentContext();

    // set the fill color
    [color setFill];

    // translate/flip the graphics context (for transforming from CG* coords to UI* coords
    CGContextTranslateCTM(context, 0, image.size.height);
    CGContextScaleCTM(context, 1.0, -1.0);

    // set the blend mode to overlay, and the original image
    CGContextSetBlendMode(context, kCGBlendModeOverlay);
    CGRect rect …
Run Code Online (Sandbox Code Playgroud)

core-graphics objective-c ios

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

为什么我的导航栏在我的状态栏下?

http://www.irovr.com/stackOverflow/overlap.png

- (void)viewDidLoad {
        [super viewDidLoad];
        [self setWantsFullScreenLayout:YES];
        [mainScrollView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onMainScrollTap:)]];
    }

- (void)onMainScrollTap:(id)sender {
    if(self.navigationController.navigationBar.hidden){
        [self.navigationController setNavigationBarHidden:NO animated:YES];
        [self.navigationController setToolbarHidden:NO animated:NO];
        [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade];
    }else{
        [self.navigationController setNavigationBarHidden:YES animated:YES];
        [self.navigationController setToolbarHidden:YES animated:YES];
        [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];
    }
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];

    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent];
    [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];

    self.navigationController.navigationBar.translucent = YES;
    self.navigationController.toolbar.translucent = YES;
}

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    [self.navigationController setNavigationBarHidden:YES animated:YES];
    [self.navigationController setToolbarHidden:YES animated:YES];
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault]; …
Run Code Online (Sandbox Code Playgroud)

iphone cocoa-touch objective-c

8
推荐指数
2
解决办法
4572
查看次数

UIView子类initWithFrame没被调用?

我有一个自定义的UIView子类.在IB中,我指定了一个"占位符"UIView并将该类设置为我的类名.我对drawRect方法的重写是有效的,并且背景正确着色,但是initWithFrame没有触发.为什么?

- (id)initWithFrame:(CGRect)frame {
    NSLog(@"initWithFrame");
    if ((self = [super initWithFrame:frame])) {
        noteTextFont = [[UIFont boldSystemFontOfSize:12] retain];
    }
    return self;
}

- (void)drawRect:(CGRect)rect {
    [super drawRect:rect];
    CGContextRef context = UIGraphicsGetCurrentContext();

    UIColor *backgroundColor = [UIColor blackColor];
    [backgroundColor set];
    CGContextFillRect(context, rect);

    UIColor *labelColor = [UIColor lightGrayColor];
    [labelColor set];
    [notificationLabel drawInRect:CGRectMake(44, 18, rect.size.width-20, rect.size.height) withFont:noteTextFont lineBreakMode:UILineBreakModeTailTruncation];

    [self setNeedsLayout];
}
Run Code Online (Sandbox Code Playgroud)

iphone cocoa-touch

8
推荐指数
2
解决办法
5513
查看次数

针对不同环境的不同Android构建

我希望能够构建和安装我的应用程序的多个版本(同时),针对不同的环境,如开发,暂存和生产.

包中的名称AndroidManifest.xml似乎是这里的主要障碍,因为它是唯一标识应用程序的内容.我认为这将是可以简单地切换com.mydomain.prod,com.mydomain.staging并且com.mydomain.dev或某种类似的规定,但到目前为止我没有运气来了与此方法适用的封装结构.

我可以采用什么策略以尽可能少的痛苦来做到这一点?

android android-manifest android-build

8
推荐指数
2
解决办法
2407
查看次数

UICollectionView分页偏移和间距

我很难过.我有这个集合视图显示单元格的边缘作为滑动可用的提示,但只有第一个和最后一个单元格正确显示.介于两者之间的一切都没有正确排队.我错过了什么?

UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.itemSize = CGSizeMake(280, 400);
layout.sectionInset = UIEdgeInsetsMake(0, 20, 0, 20);
layout.minimumInteritemSpacing = 10;
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
layout.minimumLineSpacing = 10.0;

self.collectionView.collectionViewLayout = layout;
self.collectionView.showsHorizontalScrollIndicator = NO;
self.collectionView.pagingEnabled = YES;
self.collectionView.clipsToBounds = NO;
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

ios uicollectionview uicollectionviewcell uicollectionviewlayout

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

Angular $ http.get"Uncaught SyntaxError:Unexpected token""没有文件引用,更不用说行号了

我正处于这个问题的最后阶段.我在我的应用程序看似随机的地方收到此错误.Raven从几十个地方报道他们,但我只能在当地复制一对.在我看来,问题与解析JSON响应有关,但响应是有效的.

在我的Angular服务中......

...
getThread: function(id, success, error) {
    $http.get('/message/'+id).success(function(data){
        success(data);
    }).error(error);
}
...
Run Code Online (Sandbox Code Playgroud)

在我的Express控制器中......

...
res.json(mssgs);
...
Run Code Online (Sandbox Code Playgroud)

这是一个示例响应......

[
  {
    "id": 79,
    "body": "test",
    "senderArchived": false,
    "recipientArchived": false,
    "createdAt": "2014-04-17T01:44:46.762Z",
    "updatedAt": "2014-04-17T01:44:46.762Z",
    "RootMessageId": 69,
    "SenderId": 164050,
    "RecipientId": 154040,
    "sender": {
      "username": "boca",
      "id": 164050,
      "primaryMedium": null
    },
    "recipient": {
      "username": "quimby",
      "id": 154040,
      "primaryMedium": {
        "id": "186",
        "type": "image",
        "nativeURL": "https://domain/imageurl.jpg",
        "mediumURL": "https://domain/imageurl.jpg",
        "smallURL": "https://domain/imageurl.jpg",
        "createdAt": "2014-04-21T15:52:10.927Z",
        "updatedAt": "2014-04-21T15:52:10.947Z",
        "CommentId": null,
        "EventId": null,
        "UserId": 154040,
        "PostId": null,
        "MessageId": null,
        "MediaFolderId": …
Run Code Online (Sandbox Code Playgroud)

json express angularjs

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

如何重叠 ListView 中的项目?

我想在每个项目上有一个阴影,并且每个项目应该与下一个同级项目的顶部重叠。

复合图像

flutter flutter-layout

5
推荐指数
2
解决办法
3181
查看次数