小编Inf*_*mes的帖子

UIStackView隐藏视图动画

在iOS 11中,隐藏动画在a中的行为UIStackView已发生变化,但我无法在任何地方找到此文档.

iOS 10

iOS 10动画

iOS 11

iOS 11动画

两者中的代码是这样的:

UIView.animate(withDuration: DiscoverHeaderView.animationDuration,
                       delay: 0.0,
                       usingSpringWithDamping: 0.9,
                       initialSpringVelocity: 1,
                       options: [],
                       animations: {
                            clear.isHidden = hideClear
                            useMyLocation.isHidden = hideLocation
                        },
                       completion: nil)
Run Code Online (Sandbox Code Playgroud)

如何在iOS 11上恢复以前的行为?

animation uikit ios swift uistackview

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

什么是C++中的_In_?

我已经搜索了很多,但没有得到任何有用的结果.

我目前正在尝试为Windows 8 Metro编写简单的DirextX游戏,并且遇到了_In_相当多的问题.我只是想知道它是什么.

此外,我已经看到很多使用^作为*我发现奇怪的指针.最重要的是,一些类有一个接口ref class MyClass,我相信它是C#易读性.

无论如何,任何帮助都会很棒.

c c++ microsoft-metro c++-cx

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

NSNotificationCenter观察者未收到通知

我知道为什么不收到通知的标准原因:

  • 取消分配或取消已注册的对象.
  • 以观察者的身份删除对象.
  • 没有注册为观察员.
  • 注册错误通知或发布错误通知.

我很高兴地说,我很确定这些都不会发生.我想最有可能的是,对象在某些时候被无效并重新创建,但它在初始化时注册通知.

这是我注册的地方:

/**
 *  initialises an object with a unique file url
 *
 *  @param  url                         the url to set as the file url
 */
- (id)initWithFileURL:(NSURL *)url
{
    if (self = [super initWithFileURL:url])
    {
        self.entries                    = [[NSMutableArray alloc] init];

        //  we want to be notified when a note has changed
        [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(noteChanged)
                                                     name:@"com.andbeyond.jamesvalaitis.notesChanged"
                                                   object:self];

        NSLog(@"Just registered for 'com.andbeyond.jamesvalaitis.notesChanged'");
    }

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

这是我发布通知的地方:

/**
 *  save the note content
 */
- (void)saveNote …
Run Code Online (Sandbox Code Playgroud)

nsnotifications nsnotificationcenter ios

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

removeWithCompletionHandler错误

启动时,我试图通过在每个设备上调用此方法以编程方式清除设备之间的游戏中心服务器上的所有匹配项:

/**
 *  called to authenticate the players game centre id
 */
- (void)authenticateLocalUser
{
    if (!self.gameCentreAvailable)          return;

    NSLog(@"Authenticating Local User.");

    if ([GKLocalPlayer localPlayer].authenticated == NO)
    {
        [[GKLocalPlayer localPlayer] setAuthenticateHandler:^(UIViewController* viewcontroller, NSError *error)
        {
            NSLog(@"Inside Authentication Handler.");

            //  if there was no error, and we got a valid view controller to display
            if (!error && viewcontroller)
            {
                //  get a handle to the app delegate
                AppDelegate *delegate       = [UIApplication sharedApplication].delegate;

                //  use the view controller in the app delegate to …
Run Code Online (Sandbox Code Playgroud)

objective-c ios game-center

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

Pan Gesture识别器混乱的三层

我应用程序视图层次结构的草图

在开发应用程序的同时,我遇到了一个有太多平移手势识别器的问题.我的第一个平移手势识别器位于MainViewController上,它是RecipeSearchVC的父节点.此手势识别器向左或向右滑动整个视图.我在RecipeSearchParametersVC中的第二个平移手势识别器,它是页面视图控制器的父级.第三个平移手势手势识别器被添加到嵌套在视图控制器内部的UIControl Wheel中,该控制器由PageViewController表示.

我知道这听起来很疯狂,可以说这是糟糕的设计.但是,我相信这是有效的,它会很好.

当试图旋转滚轮时,它会在手势被PageViewController或MainViewController超越之前旋转一两秒钟.通常是MainViewController接管.我可以使用哪些技术来清楚地分离这些手势识别器?

编辑:

对于泛手势识别器,我的描述含糊不清.MainViewController拥有自己的UIPanGestureRecpgniser,允许它向左或向右移动所有内容.RecipeSearchParametersVC只有一个UIPanGestureRecogniser,因为它包含UIPageViewController.它不会添加手势识别器本身,而只是从pageViewController中获取它们.UIControl的手势识别器允许它跟踪它应该经历的旋转.

在接受给出的建议时,我可以从页面视图控制器中删除手势并用按钮替换它们.我只是想让它像iBooks中的图像(可以滚动显示更多图像)一样工作,所以我认为它会正常工作.

UIControl UIPanGestureRecogniser代码

/**
 *  sent to the control when a touch related to the given event enters the control’s bounds
 *
 *  @param  touch                       uitouch object that represents a touch on the receiving control during tracking
 *  @param  event                       event object encapsulating the information specific to the user event
 */
- (BOOL)beginTrackingWithTouch:(UITouch *)touch
                     withEvent:(UIEvent *)event
{
    [super beginTrackingWithTouch:touch withEvent:event];

    CGPoint touchPoint                  = [touch locationInView:self];

    //  filter out touchs too close to centre of …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c uigesturerecognizer ios uipageviewcontroller

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

layoutAttributesForElementsInRect的无限循环

我完全不知道为什么会发生这种情况,但无论出于何种原因,我正在使用的集合视图无限循环该[UICollectionViewData layoutAttributesForElementsInRect:]方法.

集合视图位于我的自定义导航栏中.在我使用此自定义导航栏的一个场景中,一切都按预期工作.在另一种情况下,它无限循环.

  • 我已经尝试过不设置数据源或委托collectionView.
  • 我已经尝试设置数据源和委托,而是返回0itemsInSection.
  • 我在工作情况下使用自动布局,我在工作情况下初始化自定义导航栏.

关于发布代码,我不确定要发布什么.[UIWindow makeKeyAndVisible]调用后,无限循环开始.此方法永远不会返回.只是在经过时间分析之后,才发现这[UICollectionViewData layoutAttributesForElementsInRect:]是导致问题的原因.

objective-c freeze infinite-loop ios uicollectionview

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

RxSwift 共享订阅执行顺序

如何确保 的订阅者ObservableonNext在另一个订阅者之后收到事件?

我的例子如下:

let firstNameObservable = firstName.asObservable().shareReplay(1)
let lastNameObservable = lastName.asObservable().shareReplay(1)
let bioObservable = bio.asObservable().shareReplay(1)
let websiteObservable = website.asObservable().shareReplay(1)

firstNameObservable.subscribe(onNext: { [unowned self] firstName in self.accountDetails.firstName = firstName }).disposed(by: disposeBag)
lastNameObservable.subscribe(onNext: { [unowned self] lastName in self.accountDetails.lastName = lastName }).disposed(by: disposeBag)
bioObservable.subscribe(onNext: { [unowned self] bio in self.accountDetails.bio = bio }).disposed(by: disposeBag)
websiteObservable.subscribe(onNext: { [unowned self] website in self.accountDetails.website = website }).disposed(by: disposeBag)

Observable.combineLatest(firstNameObservable, lastNameObservable, bioObservable, websiteObservable)
    { [unowned self] _, _, _, _ in return …
Run Code Online (Sandbox Code Playgroud)

swift rx-swift reactive

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

Watch 上 SwiftUI 按钮中奇怪的内部视图

我刚刚开始使用 Watch 开发和 SwiftUI,并认为我会从一个简单的登录屏幕开始。我做了两个不同风格的两个按钮。奇怪的是,我的按钮有一个奇怪的红色内部视图,我不知道为什么。

struct ContentView : View
{
    var body: some View
    {
        VStack
        {
            Button( "Login")
            {            
            }
            .accentColor( .white)
            .frame( idealHeight:50.0)
            .padding( [.leading, .trailing], 10.0)
            .background( Color.red)
            .cornerRadius( 5.0)

            Button( "Sign Up")
            {
            }
            .accentColor( .red)
            .frame( idealHeight:50.0)
            .padding( [.leading, .trailing], 10.0)
            .background( Color.white)
            .cornerRadius( 5.0)
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

手表模拟器截图

有人能告诉我这里发生了什么吗?

另外,如果有人的声誉为 1500,他们可以创建 WatchOS6 标签吗?

更新:这在 iPhone 上比在手表上工作得更好,按钮在两种设备上的工作方式似乎不同。正如@MarkT 指出的那样,您需要从简单的按钮样式开始。问题在于它会阻止您使用自己的按钮样式。

swiftui watchos-6

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

失踪 ';' 在'*'之前

我看了很多"失踪"; 在"x"之前的问题,但没有找到这个特定问题的答案.

// ---- Define File ----

#ifndef AnimDefinition_h
#define AnimDefinition_h

// ---- Include ----

#include "AString.h"
#include "FileReader.h"

// ---- Global Constant Variables ----

static const int    MaxAnimations   = 16;
static const int    Blank           = 10;
static const int    EndOfLine       = 59;
static const int    Space           = 32;

// ----------------------------------------------------------------
//                      Sprite Animation Definition                     
// ----------------------------------------------------------------
class AnimDefinition
{
private:

    struct Animation
    {
        AString     mAnimationID;
        AString     mLoopTo;
        int         mFrameBegin;
        int         mFrameEnd;
    };

public:

                    AnimDefinition          (void);
                    AnimDefinition          (const char *pFileName); …
Run Code Online (Sandbox Code Playgroud)

c++

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

mutableCopy是对象的状态还是行为?

我个人坚持'使用带有状态的Objective-C中的点符号和带有行为的消息'原则.我不想谈论这个,但更多的是方法,mutableCopy,状态还是行为?

也许我应该对国家和行为之间的差异做更多的研究,但据我所知,在这种情况下我不确定.

syntax objective-c mutable

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