uicontrol

Define custom touch area in custom UIControl object

让人想犯罪 __ 提交于 2019-12-22 10:07:10
问题 I am creating a custom UIControl object as detailed here. It is all working well except for the touch area. I want to find a way to limit the touch area to only part of the control, in the example above I want it to be restricted to the black circumference only rather than the whole control area. Any idea? Cheers 回答1: You can override UIView's pointInside:withEvent: to reject unwanted touches. Here's a method that checks if the touch occurred in a ring around the center of the view: - (BOOL

How to implement range slider in Swift

亡梦爱人 提交于 2019-12-21 09:23:36
问题 I'm trying to implement Range Slider and I used custom control called NMRangeSlider. But when I use it, the slider doesn't appear at all. Could it be also because it's all written in Objective-C? This is how I've currently implemented it: var rangeSlider = NMRangeSlider(frame: CGRectMake(16, 6, 275, 34)) rangeSlider.lowerValue = 0.54 rangeSlider.upperValue = 0.94 self.view.addSubview(rangeSlider) 回答1: UPDATE: It did not show to me, because it was all white. So the solution, without using any

Get tap event for UIButton in UIControl/rotatable view

末鹿安然 提交于 2019-12-21 09:14:23
问题 Edited See the comment section with Nathan for the latest project. There is only problem remaining: getting the right button. Edited I want to have a UIView that the user can rotate. That UIView should contain some UIButtons that can be clicked. I am having a hard time because I am using a UIControl subclass to make the rotating view and in that subclass I have to disable user interactions on the subviews in the UIControl (to make it spin) which may cause the UIButtons not be tappable. How

Can I use custom values of UIControlState for my own control?

纵然是瞬间 提交于 2019-12-20 09:17:54
问题 Is there a way to set a custom states -- not one of the existing UIControlState values -- for a UIControl ? In the UIControlSate enum, there are 16 bits that can be used for custom control states: UIControlStateApplication = 0x00FF0000, // additional flags available for application use The problem is that UIControl 's state property is readonly . I want to set different background images to my UIButton for custom states. 回答1: You can make use of the custom states in a subclass of UIControl.

Using TVPosterImage in TVUIKit for tvOS 12

会有一股神秘感。 提交于 2019-12-20 04:55:23
问题 tvOS 12 has a new framework TVUIKit, which introduces the lockup views. The class I am interested in is TVPosterView, which is basically designed as such: Swift 4.2 open class TVPosterView : TVLockupView { // One may use UIControl to implement it in iOS public init(image: UIImage?) open var image: UIImage? // default is nil open var title: String? open var subtitle: String? } In my storyboard I have added an UIView element, and rightly (at least I hope so. Yesterday the IB agent kept crashing

Changing UIView To be instance from UIControl Programmatically [closed]

霸气de小男生 提交于 2019-12-13 10:03:12
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I have a button that will change the view's class to UIControl i have typed this line of code but Xcode say it is a error -(IBAction)button:(id)sender { self.view.class = [UIControl class]; } So guys my question is how to change my view's class to UIControl class programmatically 回答1: You cant change the class

horizontal uiview's controls unresponsive.. or how to foul up a view hierarchy

浪子不回头ぞ 提交于 2019-12-13 05:20:46
问题 I'm working on an app that has two sections, a config section and a results section. My config section needs to be 2 separate views (horizontal and vert, and yes, I can hear the intake of breath from here), with one rotatable view for the results. b/c of layout restraints and a lot of pain around rotation, I'm not using a navigation controller. I've been experiencing the joys of rotation experimentation and have settled upon keeping my views contained as subviews of my view controller. i.e.

Changing content of UICollectionView with segmented Control in the header in Swift

社会主义新天地 提交于 2019-12-12 06:36:58
问题 I tried to solve this problem since hours and didn't find a proper solution. I want to have a custom UICollectionView with a segmented control in the header. Changing the segmented control index should render the cells differently. So far I can display the segmented control in the header of my collectionView but changing the content of the collectionView inside of my UserSearchHeader doesn't work. I created a custom UICollectionView called UserSearchController which is a Subclass of

Updating UILabel text when variable changes

核能气质少年 提交于 2019-12-12 04:44:54
问题 I've got a UIControl class and need to do some calculation based on UIImageView location which can be moved with touchesBegan and touchesMoved (everything inside this class). Than I would like to display it as a UILabel which I've created programmatically. class control : UIControl{ ... let leftControl: UIImageView = UIImageView(image: UIImage(named: "left-control")) ... func leftValue() -> String{ var leftValue : String = "0.0" leftValue = "\(leftControl.center.x)" return leftValue } } and

UISegmentedControl with Direction or Arrow theme

核能气质少年 提交于 2019-12-12 03:35:28
问题 I have implemented UISegmentedControl with Direction theme using BASequenceControl from cocoacontrols.com . I have added BASequenceControl.h and BASequenceControl.m classes and required images from GitHub Great. Its working fine for me..However I have a concern with the last segment section tip. Its displaying the junk space of last segment section. Original Screen Shot I need like this The code I have Implemented #import "BASequenceControl.h" BASequenceControl *bASequenceControl = [