小编klc*_*r89的帖子

如何在iOS中创建自定义UIActivity?

如何UIActivity在iOS中创建自定义?

我想要这个的原因是在我的一个应用程序中添加一个Review App按钮,将用户带到App Store的评论部分.我该如何创建这样的自定义UIActivity

objective-c ios uiactivity uiactivityviewcontroller

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

使用默认的interactivePopGestureRecognizer快速向后滑动时,iOS 7损坏了UINavigationBar

我有一个问题,我坚持,但我不知道为什么它会发生; 如果我在堆栈上推送一个细节控制器,并且我使用默认的左边缘快速向后滑动interactivePopGestureRecognizer,我的父/根视图控制器UINavigationBar看起来很糟糕或类似的东西,几乎就像内置的iOS转换机制没有时间去做它的工作在细节视图消失后重置它.另外要澄清的是,这个'腐败' UINavigationBar中的所有内容仍然可以触摸,我父/根视图控制器上的所有内容都能正常工作.

对于没有源代码的人投票:没有源代码!这是一个Apple bug!

无论如何,UINavigationBar当调用父/根视图控制器的viewDidAppear方法时,是否将其重置为应该是什么?

请注意,如果我点击左上方的后退按钮而不是使用左边缘,则不会发生此错误interactivePopGestureRecognizer.

编辑:我添加了一个NSLog来检查在父/根视图控制器上viewDidAppear上的navigationBar的子视图计数,并且计数总是相同,是否损坏,所以我想知道为什么弹出的控制器会对我造成严重破坏UINavigationBar.

如果你可以帮助我,我会非常感激!谢谢.

我附上了它的外观截图:请注意,后面的V形图不是我的父/根视图控制器的一部分,它是从堆栈中弹出的部分.Testing123是父/根视图控制器的标题,而不是从堆栈弹出的标题.头部和齿轮图标是父/根视图控制器的一部分.

编辑:我认为这样的事情可以解决问题,但事实证明它没有,而且IMO也是非常糟糕的经历.这不是我正在寻找的那种解决方案.我发布了大笔奖金,所以这可以正确解决!.我只是不能在生产质量的应用程序中有这种奇怪的UI行为.

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

    [self.navigationController pushViewController:[UIViewController new] animated:NO];
    [self.navigationController popToRootViewControllerAnimated:YES];
}
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

uinavigationbar uinavigationcontroller ios ios7

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

无法从Apple开发人员中心删除App ID

我已经看到Apple在哪里更改了iOS开发中心的证书,标识符和配置文件页面,并在堆栈上阅读此问题/答案:从开发人员连接中删除App ID

但我无法删除我想删除的几年前的应用ID/ID."删除"按钮显示为灰色/未启用.

有人可以帮助我吗?我尝试过多个浏览器并清除缓存无济于事.先感谢您!

截图: 在此输入图像描述

iphone ios

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

使用CGImageDestinationFinalize创建一个大型GIF - 内存不足

我正在尝试在创建包含大量帧的GIF时修复性能问题.例如,某些GIF可能包含> 1200帧.使用我当前的代码,我的内存不足.我正在试图弄清楚如何解决这个问题; 这可以分批完成吗?我的第一个想法是,是否可以将图像附加在一起,但我认为没有一种方法可以用于ImageIO框架创建GIF或如何创建GIF .如果有一个复数CGImageDestinationAddImages方法但没有,那将是很好的,所以我迷失了如何尝试解决这个问题.我感谢任何提供的帮助.对于冗长的代码提前抱歉,但我觉得有必要逐步创建GIF.

只要视频中可能存在不同的GIF帧延迟,并且录制时间与每帧中所有动画的总和不一样,我就可以制作视频文件而不是GIF.

注意:跳转到下面的最新更新标题以跳过背景故事.

更新1 - 6:使用固定的线程锁定GCD,但内存问题仍然存在.这里不需要100%的CPU利用率,因为我展示了一段UIActivityIndicatorView时间的工作.使用该drawViewHierarchyInRect方法可能比renderInContext方法更有效/更快,但是我发现您不能drawViewHierarchyInRect在后台线程上使用该方法,并将afterScreenUpdates属性设置为YES; 它锁定了线程.

必须有一些方法可以分批编写GIF.我相信我已经将内存问题缩小到:CGImageDestinationFinalize这种方法对于制作具有大量帧的图像来说效率非常低,因为所有内容都必须在内存中写出整个图像.我已经证实了这一点,因为我在抓取渲染的containerView图层图像和调用时使用了很少的内存CGImageDestinationAddImage.我打电话CGImageDestinationFinalize给记忆仪的那一刻立即飙升; 有时最高可达2GB,具体取决于帧数.所需的内存量似乎很疯狂,可以制作~20-1000KB的GIF.

更新2:我发现有一种方法可能会带来一些希望.它是:

CGImageDestinationCopyImageSource(CGImageDestinationRef idst, 
CGImageSourceRef isrc, CFDictionaryRef options,CFErrorRef* err) 
Run Code Online (Sandbox Code Playgroud)

我的新想法是,对于每10帧或其他任意帧数,我会将它们写入目的地,然后在下一个循环中,先前完成的10帧目标将成为我的新源.但是有一个问题; 阅读文档,它说明了这一点:

Losslessly copies the contents of the image source, 'isrc', to the * destination, 'idst'. 
The image data will not be modified. No other images should be added to the image destination. 
* CGImageDestinationFinalize() should not be …
Run Code Online (Sandbox Code Playgroud)

core-graphics objective-c gif cgimage ios

25
推荐指数
2
解决办法
4518
查看次数

将UITabBar定位在顶部

我是iOS开发的初学者.我的问题是:是否可以将UITabBar放在顶部以及如何定位?我不能将我的UITabBar放在视图的顶部.

objective-c uitabbar ios swift

24
推荐指数
4
解决办法
3万
查看次数

点击状态栏时,UIPageViewController可防止我的表格视图滚动到顶部

我在发布这个问题之前搜索过,但找不到任何东西.

我有一个很大的问题.我有一个滚动类型UIPageViewController作为我的应用程序的基础,有3个视图控制器.

其中一个视图控制器(listTableView)具有表视图和搜索显示控制器.

问题是,当像状态表视图一样点击状态栏时,我无法滚动到表格视图的顶部.我相信UIPageViewController正在干扰这个,但我不知道如何修复它,但我知道我需要让我的应用程序不会感到破碎.

我感谢任何提供的帮助.

我知道有人会要求代码,即使在这种情况下它是无关紧要的,但这里是为了创建UIPageViewController:

#import "MainViewController.h"

@interface MainViewController ()

@property (nonatomic, strong) UIPageViewController *pageViewController;
@property (nonatomic, strong) NSArray *contentViewControllers;

@end

@implementation MainViewController

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.pageViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"PageView"];
    self.pageViewController.dataSource = self;

    UIViewController *settings = [self.storyboard instantiateViewControllerWithIdentifier:@"Settings"];

    UIViewController *listTableView = [self.storyboard instantiateViewControllerWithIdentifier:@"List"];

    UIViewController *first = [self.storyboard instantiateViewControllerWithIdentifier:@"First"];

    self.contentViewControllers = [NSArray arrayWithObjects:settings,listTableView,first,nil];

    [self.pageViewController setViewControllers:@[first] direction:UIPageViewControllerNavigationDirectionReverse animated:NO completion:nil];

    [self addChildViewController:self.pageViewController];
    [self.view addSubview:self.pageViewController.view];
    [self.pageViewController didMoveToParentViewController:self];

    self.view.backgroundColor = [UIColor colorWithRed:(248.0/255.0) green:(248.0/255.0) blue:(248.0/255.0) alpha:1.0];
}

- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController
  viewControllerBeforeViewController:(UIViewController *)viewController …
Run Code Online (Sandbox Code Playgroud)

objective-c uitableview uisearchdisplaycontroller ios uipageviewcontroller

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

如何检测HDMI线是否插入PCMCIA卡/无信号?

我正在尝试编写一个简单的帮助应用程序,用于在没有检测到信号的情况下提示用户打开摄像机,这在这种情况下意味着摄像机关闭和/或HDMI电缆没有插入PCMCIA采集卡.如果信号存在,那么我将启动相应的录制应用程序,在本例中为Wirecast.

我怎么可能在VisualStudio中使用C#创建它?

更新

我认为现在我已经接近了一个基于其中一条建议的建议,建议使用GraphEdit并查看硬件上可用的内容.我能够在捕获设备的属性中找到一个"信号检测"标志,如果摄像机打开/关闭或拔掉HDMI电缆,它会从0变为1,这就是我想要的.

现在,我将如何通过代码访问此标志?我想我真的很亲密,但不知道如何访问cElemspElems从中获取结构caGUID.cElems返回值3,这与屏幕截图中显示的GraphEdit属性窗口中显示的选项卡数相同.pElems每次运行应用程序时都会返回不同的值,所以我不确定该结构中发生了什么.我认为我正在寻找的旗帜位于这些结构中的某个位置.

码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using DirectShowLib;

namespace Test
{
    static class Program
    {
        [STAThread]

        static void Main()
        {
            using (System.Threading.Mutex mutex = new System.Threading.Mutex(false, "Global\\" + appGuid))
            {
                if (!mutex.WaitOne(0, false))
                {
                    return;
                }

                DsDevice[] capDevices = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice);

                foreach (var dev in capDevices)
                {
                    if (dev.DevicePath == @"@device:pnp:\\?\pci#ven_1131&dev_7160&subsys_12abf50a&rev_03#6&37bccbbe&0&000800e1#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\{6f814be9-9af6-43cf-9249-c0340100021c}")
                    {
                        IFilterGraph2 m_FilterGraph = (IFilterGraph2)new FilterGraph();

                        IBaseFilter capFilter = null; …
Run Code Online (Sandbox Code Playgroud)

c# directshow graphedit pci

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

UITextView的文字超越了界限

我有一个不可滚动的UITextView,它的layoutManager maximumNumberOfLines设置为9,工作正常,但是,我似乎无法在NSLayoutManager中找到一个限制文本不超出UITextView框架的方法.

例如,在此屏幕截图中,光标位于第9行(第1行被剪切在屏幕截图的顶部,因此请忽略它).如果用户继续键入新字符,空格或点击返回键,则光标将继续在屏幕外显示,并且UITextView的字符串将继续变长.

在此输入图像描述

由于外来字符大小不同,我不想限制UITextView的字符数.

我一直试图解决这个问题几个星期; 我非常感谢任何帮助.

CustomTextView.h

#import <UIKit/UIKit.h>

@interface CustomTextView : UITextView <NSLayoutManagerDelegate>

@end
Run Code Online (Sandbox Code Playgroud)

CustomTextView.m

#import "CustomTextView.h"

@implementation CustomTextView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        self.backgroundColor = [UIColor clearColor];
        self.font = [UIFont systemFontOfSize:21.0];
        self.dataDetectorTypes = UIDataDetectorTypeAll;
        self.layoutManager.delegate = self;
        self.tintColor = [UIColor companyBlue];
        [self setLinkTextAttributes:@{NSForegroundColorAttributeName:[UIColor companyBlue]}];
        self.scrollEnabled = NO;
        self.textContainerInset = UIEdgeInsetsMake(8.5, 0, 0, 0);
        self.textContainer.maximumNumberOfLines = 9;
    }
    return self;
}

- (CGFloat)layoutManager:(NSLayoutManager *)layoutManager lineSpacingAfterGlyphAtIndex:(NSUInteger)glyphIndex withProposedLineFragmentRect:(CGRect)rect
{
    return 4.9;
}

@end
Run Code Online (Sandbox Code Playgroud)

更新,仍未解决

objective-c uitextview ios ios7

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

UIImagePickerController编辑视图圆叠加

我已经能够完成我想要完成的任务,那就是复制iOS内置的圆形照片裁剪器,用于内置的联系人应用程序.但是,我一直在试图让我的CAShapeLayers制作正确.我正在尝试制作一个透明的320像素直径圆圈,其余部分则填充0.9 alpha黑色背景.圆形和矩形在正确的位置,但是,圆形并不像我需要的那样完全透明.

我迷失了如何解决这个问题.我感谢您的帮助!代码和截图:

- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    if ([navigationController.viewControllers count] == 3)
    {
        CGRect screenRect = [[UIScreen mainScreen] bounds];
        CGFloat screenHeight = screenRect.size.height;

        UIView *plCropOverlay = [[[viewController.view.subviews objectAtIndex:1]subviews] objectAtIndex:0];

        plCropOverlay.hidden = YES;

        CAShapeLayer *circleLayer = [CAShapeLayer layer];

        if (screenHeight == 568)
        {
            [circleLayer setPosition:CGPointMake(0.0f,124.0f)];
        }    
        else
        {
            [circleLayer setPosition:CGPointMake(0.0f,80.0f)];
        }

        UIBezierPath *path = [UIBezierPath bezierPathWithOvalInRect:
                          CGRectMake(0.0f, 0.0f, 320.0f, 320.0f)];

        [circleLayer setPath:[path CGPath]];

        [circleLayer setFillColor:[[UIColor whiteColor] CGColor]];
        circleLayer.opacity = 0.7f;

        // Set to 0.7f to show …
Run Code Online (Sandbox Code Playgroud)

objective-c uiimagepickercontroller cashapelayer ios ios7

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

从MSMessagesAppViewController正确呈现UIAlertController

我正在试图弄清楚如何在我的iMessage应用扩展程序中显示UIAlertController一种风格UIAlertControllerStyleActionSheet.

问题是,当调用时,操作表显示在本机iMessage文本字段下方:

[self.view.window.rootViewController presentViewController:actionSheetController animated:YES completion:NULL];

我该如何解决这个问题?

码:

UIAlertController *actionSheetController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Clear", nil) message:nil preferredStyle:UIAlertControllerStyleActionSheet];

UIAlertAction *clear = [UIAlertAction actionWithTitle:NSLocalizedString(@"Clear", nil) style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action)
{
    [self clear];
}];

UIAlertAction *cancel = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", nil) style:UIAlertActionStyleCancel handler:^(UIAlertAction *action)
{}];

[actionSheetController addAction:clear];
[actionSheetController addAction:cancel];

[self.view.window.rootViewController presentViewController:actionSheetController animated:YES completion:NULL];
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

objective-c ios msmessage

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