小编Xia*_*ang的帖子

iOS 7 - 如何在表格视图中显示日期选择器?

在WWDC 2013视频中,Apple建议在iOS 7的表格视图中显示选择器.如何在表格视图单元格之间插入和动画视图?

像这样,从Apple日历应用程序:

就地日期选择器

uidatepicker uitableview ios7 datecell swift

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

适用于Android的本地图像缓存解决方案:Square Picasso,Universal Image Loader,Glide,Fresco?

我正在寻找Android中的异步图像加载和缓存库.我打算使用Picasso,但我发现Universal Image Loader在GitHub上更受欢迎.有谁知道这两个图书馆?优点和缺点的摘要会很棒.

(我的所有图像都在本地磁盘上,因此我不需要联网,因此我认为Volley不合适)

android universal-image-loader picasso fresco android-glide

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

当摄像机视图中的内容发生变化时,"点按以对焦"至"自动对焦".像在相机应用程序或iOS的UIImagePickerController中的逻辑?

当视图中的内容发生变化时,如何在失去焦点后自动处理从特定POI的"点击到焦点"切换回"自动对焦"状态?如果您注意到相机应用程序或UIImagePickerController中的焦点行为,在您点击一些区域并移动手机后,相机可以自动切换到屏幕中央的连续自动对焦.

我需要比UIImagePickerController可以提供的更多的灵活性,所以我需要首先使用AVFoundation来模仿UIImagePickerController行为......

camera key-value-observing avfoundation autofocus ios

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

使用Jcodec在Android上创建mp4文件

我在使用MediaRecorder和Jcodec在Android上编写mp4文件时遇到了一些麻烦,这是我的代码

public class SequenceEncoder {
    private final static String CLASSTAG = SequenceEncoder.class.getSimpleName();

    private SeekableByteChannel ch;

    private byte[] yuv = null;

    private ArrayList<ByteBuffer> spsList;
    private ArrayList<ByteBuffer> ppsList;

    private CompressedTrack outTrack;

    private int frameNo;
    private MP4Muxer muxer;

    ArrayList<ByteBuffer> spsListTmp = new ArrayList<ByteBuffer>();
    ArrayList<ByteBuffer> ppsListTmp = new ArrayList<ByteBuffer>();

    // Encoder
    private MediaCodec mediaCodec = null;

    public SequenceEncoder(File out) throws IOException {
        this.ch = NIOUtils.writableFileChannel(out);

        // Muxer that will store the encoded frames
        muxer = new MP4Muxer(ch, Brand.MP4);

        // Add video track to muxer …
Run Code Online (Sandbox Code Playgroud)

mp4 android h.264 muxer jcodec

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

删除将文件和实际文件存储为路径的核心数据项的最佳做法是保存在磁盘上?

我有一张专辑照片核心数据模型.照片实体有一列用于保存在磁盘上的实际照片文件的路径.删除照片和相册的最佳做法是什么?在核心日期删除项目之前,是否必须手动删除磁盘上的文件?照片对象很容易.但是对于一张专辑,这些照片可能已被级联删除规则删除,现在需要逐个循环处理这些文件.

对我来说,最好的做法是什么?

(我决定不使用"允许外部存储"来解决其他问题)

core-data objective-c ios

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

如何让Android Render Script Group工作?

我可以让两个独立的内在函数工作,但不能在ScriptGroup中一起工作.我发现有关如何使用Script Group的文档非常稀疏.

这是我的代码:

mRS = RenderScript.create(getActivity());

mInAllocation = Allocation.createFromBitmap(mRS, mBitmapIn,
        Allocation.MipmapControl.MIPMAP_NONE,
        Allocation.USAGE_SCRIPT |
                Allocation.USAGE_GRAPHICS_TEXTURE |
                Allocation.USAGE_SHARED);

mOutAllocation = Allocation.createFromBitmap(mRS, mBitmapOut,
        Allocation.MipmapControl.MIPMAP_NONE,
        Allocation.USAGE_SCRIPT |
                Allocation.USAGE_SHARED);

ScriptIntrinsicColorMatrix gray = ScriptIntrinsicColorMatrix.create(mRS, Element.U8_4(mRS));
gray.setGreyscale();

ScriptIntrinsicBlur blur = ScriptIntrinsicBlur.create(mRS, Element.U8_4(mRS));
blur.setRadius(20.f);
blur.setInput(mInAllocation);

//gray.forEach(mInAllocation, mOutAllocation);
blur.forEach(mOutAllocation);

mOutAllocation.copyTo(mBitmapOut);
Run Code Online (Sandbox Code Playgroud)

灰色和模糊都有效.然后我尝试将它们放在一起,结果是空白的.码:

// gray.forEach(mInAllocation, mOutAllocation);
// blur.forEach(mOutAllocation);
// mOutAllocation.copyTo(mBitmapOut);

ScriptGroup.Builder builder = new ScriptGroup.Builder(mRS);
builder.addKernel(gray.getKernelID());
builder.addKernel(blur.getKernelID());
builder.addConnection(mInAllocation.getType(), gray.getKernelID(), blur.getKernelID());

ScriptGroup group = builder.create();
group.setInput(gray.getKernelID(), mInAllocation);
group.setOutput(blur.getKernelID(), mOutAllocation);
group.execute();

mOutAllocation.copyTo(mBitmapOut);
Run Code Online (Sandbox Code Playgroud)

android renderscript

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

Android编码器复用器:原始h264到mp4容器

我创建了一个h264原始视频文件,我能够在Android 4.3及更高版本上与Android MediaMuxer进行复用.现在我需要支持Android版本4.1和4.2.我找到了Jcodec.这样做有一个例子:

https://github.com/jcodec/jcodec/blob/master/samples/main/java/org/jcodec/samples/mux/AVCMP4Mux.java

但是我在第70行得到了java.nio.ReadOnlyBufferException异常:

H264Utils.encodeMOVPacket(数据);

我想这段代码不适用于Android?我该如何解决.熟悉Jcodec的人可以帮忙解决这个问题吗?

android codec h.264 muxer jcodec

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

CIDetector和UIImagePickerController

我正在尝试实现内置的iOS 5人脸检测API.我正在使用一个UIImagePickerController允许用户拍照的实例,然后我试图CIDetector用来检测面部特征.不幸的是,featuresInImage总是返回一个大小为0的数组.

这是代码:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
UIImage* picture = [info objectForKey:UIImagePickerControllerOriginalImage];

NSNumber *orientation = [NSNumber numberWithInt:
                         [picture imageOrientation]];
NSDictionary *imageOptions =
[NSDictionary dictionaryWithObject:orientation
                            forKey:CIDetectorImageOrientation];

CIImage *ciimage = [CIImage imageWithCGImage:[picture CGImage]
                                     options:imageOptions];


NSDictionary *detectorOptions =
[NSDictionary dictionaryWithObject:CIDetectorAccuracyLow
                            forKey:CIDetectorAccuracy];
CIDetector *detector = [CIDetector detectorOfType:CIDetectorTypeFace
                                          context:nil
                                          options:detectorOptions];

NSArray *features = [detector featuresInImage:ciimage];
NSLog(@"Feature size: %d", features.count);
}
Run Code Online (Sandbox Code Playgroud)

这总是返回0个功能.但是,如果我从应用程序内置的文件中使用UIImage,则人脸检测效果很好.

我正在使用这篇Pragmatic Bookshelf文章中的代码.

对于它的价值,我认为错误是当我将UIImage从相机转换为CIImage时,但它可能是任何东西.

core-image face-detection orientation ios cifacefeature

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

在UIView动画循环中重复延迟?

我正在尝试在视图不透明度上执行自定义动画,如下所示:

  1. 延迟5秒; (视图将保持不透明5秒)
  2. 从不透明度值1到0的动画;
  3. 延迟5秒; (视图将保持透明5秒)
  4. 从不透明度值0到1的动画;

我想无限期地重复步骤1到4:1,2,3,4,1,2,3,4 ......

这是我尝试过的:

[UIView animateWithDuration:1
                      delay:5
                    options:UIViewAnimationOptionAutoreverse|UIViewAnimationOptionRepeat|UIViewAnimationOptionCurveEaseInOut
                 animations:^{
                     self.imageView.layer.opacity = 0;
                 }
                 completion:nil
 ];
Run Code Online (Sandbox Code Playgroud)

但延迟只出现在开头一次,我最终得出的结果是:

1,2,4,2,4,2,4 ......

delay repeat uiview uiviewanimation ios

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

RenderScript支持库在x86设备上崩溃

我正在android.support.v8.renderscript.*使用x86设备Razor i 运行FATAL EXCEPTION .如果我使用问题就消失了.android.renderscript.*此外,ARM设备没有问题.这是一个例外:

03-03 18:35:26.009  25011-25011/com.example.app E/AndroidRuntime? FATAL EXCEPTION: main
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.app/com.example.app.MainActivity}: android.support.v8.renderscript.RSRuntimeException: Error loading RS jni library: java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1306]:   143 cannot locate '__strlen_chk'...
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2115)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2153)
            at android.app.ActivityThread.access$700(ActivityThread.java:137)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:5031)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: android.support.v8.renderscript.RSRuntimeException: Error loading RS jni library: java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1306]:   143 cannot locate '__strlen_chk'... …
Run Code Online (Sandbox Code Playgroud)

android renderscript

5
推荐指数
3
解决办法
2807
查看次数