Tag: uikit

按下button时如何切换标签的隐藏?

我想弄清楚如何只显示一个标签,而在操作系统按下button。 我知道如何操作触摸事件,但我不确定如何将UILongPressGestureRecognizer合并到此。

iOS有一个EventTouchDown时更改UIButton的Alpha

当有一个EventTouchDown的时候,我想要改变一个UIButton的alpha值。 我希望有一种方法可以做到类似于下面的代码: [self.myButton setImage:<#(UIImage *)#> forState:UIControlEventTouchDown]; 有没有办法做这样的事情“setAlpha”? 谢谢!!!

iOS按住手势+点按

我有一个按住手势。 在按住期间,我想在屏幕上的其他地方检测到单击。 问题是,当我开始在屏幕上的其他地方点击时,按住手势会中断,不会调用“触摸”function。 有没有办法在别的地方保留新闻和持有?

iPad的GroupTableViewBackgroundColor破碎?

任何人都知道如何在iPad上获得groupTableViewBackgroundColor? 这似乎在4.2中被打破。 我试图抓取如果从使用颜色select器的视图,但是当我重新使用它作为另一个视图的背景颜色它是一个不同的灰色阴影。

XCode 8奇怪的游乐场错误,无法查找符号

我试图在Xcode 8的Playground中使用自动布局。但是,一旦我添加了行,我开始接收这个错误: Playground execution failed: error: Couldn't lookup symbols: __TWPCSo6UIView17PlaygroundSupport22PlaygroundLiveViewableS0_ __swift_FORCE_LOAD_$_swiftCoreGraphics __swift_FORCE_LOAD_$_swiftDarwin __TMaC17PlaygroundSupport14PlaygroundPage __swift_FORCE_LOAD_$_swiftObjectiveC __swift_FORCE_LOAD_$_swiftUIKit _playground_log_hidden _playground_logger_initialize __swift_FORCE_LOAD_$_swiftCoreImage __swift_FORCE_LOAD_$_swiftDispatch __TFC17PlaygroundSupport14PlaygroundPageau7currentS0_ __swift_FORCE_LOAD_$_swiftFoundation __TFC17PlaygroundSupport14PlaygroundPages8liveViewGSqPS_22PlaygroundLiveViewable__ * thread #1: tid = 0x14b6b4, 0x000000010f2f43c0 MyPlayground`executePlayground, queue = 'com.apple.main-thread', stop reason = breakpoint 1.2 * frame #0: 0x000000010f2f43c0 MyPlayground`executePlayground frame #1: 0x000000010f2f39c0 MyPlayground`__37-[XCPAppDelegate enqueueRunLoopBlock]_block_invoke + 32 frame #2: 0x000000010fe0c89c CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + […]

应用程序崩溃在runTransitionForCurrentState但没有线索为什么

我试过寻找这个,但没有运气,所以希望有一些上师可能知道答案。 我在iTunes Connect中看到大量的报告与特定的堆栈跟踪崩溃,但是堆栈跟踪显示没有任何用处。 #0. Crashed: main 0 UIKit 0x1871100c0 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 324 1 UIKit 0x1871100bc __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 320 2 UIKit 0x1870630c8 _runAfterCACommitDeferredBlocks + 292 3 UIKit 0x187070a80 _cleanUpAfterCAFlushAndRunDeferredBlocks + 92 4 UIKit 0x186da25a4 _afterCACommitHandler + 96 5 CoreFoundation 0x181c0c728 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32 6 CoreFoundation 0x181c0a4cc __CFRunLoopDoObservers + 372 7 CoreFoundation 0x181c0a8fc __CFRunLoopRun + […]

UIKitdynamic:识别圆形形状和边界

我正在写一个应用程序,我使用UIKitdynamic来模拟不同圈子之间的相互作用。 我用下面的代码创build我的圈子: self = [super initWithFrame:CGRectMake(location.x – radius/2.0, location.y – radius/2, radius, radius)]; if (self) { [self.layer setCornerRadius: radius /2.0f]; self.clipsToBounds = YES; self.layer.masksToBounds = YES; self.backgroundColor = color; self.userInteractionEnabled = NO; } return self; 其中位置表示圆的期望位置,半径是其半径。 然后我将这些圈子添加到不同的UIBehaviours,做到: [_collision addItem:circle]; [_gravity addItem:circle]; [_itemBehaviour addItem:circle]; itemBaviour定义如下: _itemBehaviour = [[UIDynamicItemBehavior alloc] initWithItems:@[square]]; _itemBehaviour.elasticity = 1; _itemBehaviour.friction = 0; […]

捕获UIView的图像(renderInContext工作不正常)

我正在尝试使用renderInContex捕获一个UIView的图像,但它不能完全捕获所有的子视图。 (例如,它不捕获UITextView的单词,并且根本不捕获UIButton 。) 我可以用什么来代替? 编辑:问题其实不是renderInContext ,而是我的实现。 看到我的新问题: https : //stackoverflow.com/q/8865207/542687

我的UIView不渲染

我是iOS开发新手,我很难理解这些部分如何组合在一起,以及如何最好地使用Interface Builder(是的,我想使用IB 并理解它如何与代码中的变化相关)。 这是我目前的情况: 我创build了一个类PageViewController : UIPageViewController ,我已经在IB中与“页面视图控制器场景”关联了。 这是初始视图控制器。 我创build了一个类Page1ViewController : UIViewController ,我已经在IB中与“Page1 View Controller Scene”相关联。 同样在IB中,我添加了一个UIView到那个场景,它有一个不透明的白色背景和一个标签。 在PageViewController的viewDidLoad方法中,我执行以下操作: setViewControllers([Page1ViewController()], direction: UIPageViewControllerNavigationDirection.Forward, animated: true, completion: nil) 在这两个PageViewController和Page1ViewController的viewDidLoad方法,我有一个println ,都显示,所以我知道他们正在加载…但是当我运行我的应用程序,我有一个空白的黑屏。 这是我想要完成的: PageViewController具有我想在IB中devise的多个自定义页面(它们不像开箱即用的日历示例,数据源确定每个页面视图) 当应用程序启动时,我想要PageViewController显示第一页( PageView1Controller ) 我对Swift感到满意,但UIKit框架目前有点令人生畏。 任何指导将不胜感激。

iOS – 在UITableViewCell里面添加UITextField的Target / Action

我有UITableView使用包含UITextField的自定义UITableViewCell 。 我想调用一个方法( myMethod ),当它被点击( UIControlEventTouchDown ),并尝试通过执行以下步骤在UITableView委托方法cellForRowAtIndexPath内连线: [tf addTarget:self action:@selector(myMethod) forControlEvents:UIControlEventTouchDown]; 当UITextField被点击时,没有任何反应。 我试图为UITableView之外的另一个UITextField做同样的事情: [othertf addTarget:self action:@selector(myMethod) forControlEvents:UIControlEventTouchDown]; 当我点击othertf ,就像我期望的那样调用该方法。 我有点困惑,因为代码是相同的,除了我换了othertf tf 。 以下是cellForRowAtIndexPath的完整代码: – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *DetailCellIdentifier = @"DetailFieldView"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:DetailCellIdentifier]; if (cell == nil) { NSArray *cellObjects = [[NSBundle mainBundle] loadNibNamed:DetailCellIdentifier owner:self options:nil]; cell = […]