uibutton

UIButton with CAShapeLayer makes title disappear while scrolling

限于喜欢 提交于 2020-01-06 16:26:06
问题 I have a ProfileCollectionViewCell with one method: func configureCellWithProfile(profile: Profile) { shapeLayer.removeFromSuperlayer() let path = CGPathCreateMutable() CGPathMoveToPoint(path, nil, 0, 0) CGPathAddLineToPoint(path, nil, CGRectGetWidth(likeButton.frame), 0) CGPathAddLineToPoint(path, nil, CGRectGetWidth(likeButton.frame), CGRectGetHeight(likeButton.frame)) CGPathCloseSubpath(path) shapeLayer.fillColor = profile.favourite ? UIColor.brilliantRose().CGColor : UIColor.blackSqueeze(

UIButton with CAShapeLayer makes title disappear while scrolling

落花浮王杯 提交于 2020-01-06 16:24:14
问题 I have a ProfileCollectionViewCell with one method: func configureCellWithProfile(profile: Profile) { shapeLayer.removeFromSuperlayer() let path = CGPathCreateMutable() CGPathMoveToPoint(path, nil, 0, 0) CGPathAddLineToPoint(path, nil, CGRectGetWidth(likeButton.frame), 0) CGPathAddLineToPoint(path, nil, CGRectGetWidth(likeButton.frame), CGRectGetHeight(likeButton.frame)) CGPathCloseSubpath(path) shapeLayer.fillColor = profile.favourite ? UIColor.brilliantRose().CGColor : UIColor.blackSqueeze(

No Visible interface for 'AVAudioPlayer declares the selector initWithUrl:'

安稳与你 提交于 2020-01-06 15:14:43
问题 I am trying to play a button click sound,also that i should be able to manage click sound along with volume button. What i have done is Added AVFoundationFramework to project, in .h file #import <AVFoundation/AVAudioPlayer.h> #import <AVFoundation/AVFoundation.h> in .m file under button click method NSString *soundPath = [[NSBundle mainBundle] pathForResource:@"sound1" ofType:@"mp3"]; NSURL *soundUrl = [NSURL fileURLWithPath:soundPath]; AVAudioPlayer *player = [[AVAudioPlayer alloc]

Creating buttons with an Array

99封情书 提交于 2020-01-06 12:27:29
问题 I have 44 buttons that I am adding to a scrollview and I was trying to use a series of arrays to do so. I have arrays for the name strings of the filenames, for the Y sizes of the pics (all x's are the same) and a few others. The code that I have in my viewDidLoad that runs the method is this: for (int i = 0; i < 44; i++) { [self makeLabelsAndButtons:i]; } And the method makeLabelsAndButtons is here: -(void)makeLabelsAndButtons:(NSInteger *)indexPath{ NSString *nameString = [nameArray

XCTestCase of a UIButton tap

浪子不回头ぞ 提交于 2020-01-06 04:54:06
问题 I am trying to unit test the wiring of button taps in a UIViewController but I'm finding these tests fail even though the code in the running app works fine. I've simplified the failing test by removing the view controller and such leaving simply: import XCTest class ButtonTest: XCTestCase { var gotTap: XCTestExpectation! func test_givenButtonWithTargetForTapAction_whenButtonIsSentTapAction_thenTargetIsCalled() { gotTap = expectation(description: "Button tap recieved") let button = UIButton()

Retrieve and change the point at which touchUpInside changes to touchUpOutside

末鹿安然 提交于 2020-01-05 20:21:05
问题 I have made a UISlider work just like the "slide to unlock" slider. What I need to do is determine the point at which lifting your finger off is classed as touchUpOUTSIDE and not touchUpINSIDE . This is the point where you slide your finger past the end of the slider too far. I guess it's the same as with a UIButton , you can press the button then slide your finger off the button and depending how far you go, it can still be classed as touchUpInside . If possible, i'd like to mark the target

segue to a view from a tableview in different class

和自甴很熟 提交于 2020-01-05 12:32:29
问题 To explain the issue, I had ViewControllerA with a UITableView called commentTableView inside of it. and from commentTableView i would segue to ViewControllerB but I needed to add an addition UITableView called mentionedFriendTable to ViewControllerA . But once i did add mentionFriendTable I started to have issues with the tables that caused the app to crash. Issue Im Having I decided to place commentTableView into a different class called justCommentsTable which is a UITableViewController

segue to a view from a tableview in different class

匆匆过客 提交于 2020-01-05 12:32:13
问题 To explain the issue, I had ViewControllerA with a UITableView called commentTableView inside of it. and from commentTableView i would segue to ViewControllerB but I needed to add an addition UITableView called mentionedFriendTable to ViewControllerA . But once i did add mentionFriendTable I started to have issues with the tables that caused the app to crash. Issue Im Having I decided to place commentTableView into a different class called justCommentsTable which is a UITableViewController

UIButton different alignment for title and image

南楼画角 提交于 2020-01-05 10:29:01
问题 Hello I am creating UIButton which is displaying image and title at the same time. I want title and image to be both centred, button to be above image. Problem is that because of localisation of string from button, string length is changing, and alignment from UIStoryboard combined with edge insets is not working as I want it to work. Can someone help me and point me in the right direction? 回答1: set these two. 1. set Align controls of UIButton set Image and Text Inset of UIButton 回答2: The

Objective C : UIButton image with NSArray in a random order

a 夏天 提交于 2020-01-05 09:05:48
问题 Brief Idea about the flow : I have say minimum 1 and maximum 18 records in my database with a text and an image from which I have to fetch images and place any 3 of the same randomly to 3 UIButtons among which one image should match with my question. i.e. 1 is the answer and other 2 are the distractors. For Example : Question is : where is Apple? Now among the bunch of images, I want to place any 3 images on the 3 UIButtons(1 answer i.e. An Apple and 2 distractors) in a random order and on