uikit

disable tint on custom uibarbuttonitem images

烈酒焚心 提交于 2020-01-11 05:02:10
问题 i have some custom bar button items in my navigation controller. (maximize the image to see the borders better) the above screenshot is how it should look like and how i added the barbutton item image. as you can see, the icon has some darker gradients on top. but since all icons get tinted, this dark gradient gets also tinted white and my icon looks extremely blurry. i just dropped them into my storyboard. is there a way to disable tinting this barbuttonitems? 回答1: In iOS 7, a navigation bar

UITextView/UILabel with background but with spacing between lines

橙三吉。 提交于 2020-01-10 19:43:11
问题 How can I achieve this kind of style in iOS? I tried using NSAttributedString and setting NSBackgroundColorAttributeName as blackColor but then it doesn't have a clearColor space between the lines. I also tried to set a lineSpacing to the NSMutableParagraphStyle but still, the style looks like one big black block. I just need a hint in which way to go... thanks! In other words, not something like this: 回答1: After some research I found the best solution for what I needed. The solution below is

UISegmentedControl iOS 13 clear color

南楼画角 提交于 2020-01-10 16:15:46
问题 On iOS 12, to get a UISegmentedControl with clear border, clear divider line, everything clear was easy. All I did was this: settingControl.tintColor = .clear let font = myFont let boldfont = myBoldFont settingControl.setTitleTextAttributes([NSAttributedString.Key.foregroundColor : UIColor.white, NSAttributedString.Key.font:font], for: .normal) settingControl.setTitleTextAttributes([NSAttributedString.Key.foregroundColor : UIColor.red, NSAttributedString.Key.font:boldfont], for: .selected)

UITableview edit/done button

喜你入骨 提交于 2020-01-10 08:21:08
问题 I have a tableview and navigation bar on the top. I have a Edit button on the left of my navigation bar with the following line of code. self.navigationItem.leftBarButtonItem = self.editButtonItem; When i click on the edit button, it changes to done button. All is fine so far. Where do i add code, if i want to do a small operation when the Done button is clicked.? 回答1: The button stops committing the changes to your controller class once you override it's default action with self

How can I send two arguments in a selector method?

我怕爱的太早我们不能终老 提交于 2020-01-10 04:43:47
问题 In the following, how can I send two arguments in togButton method? I tried, but it did not work. [button addTarget:self action:@selector(togButton:) forControlEvents:UIControlEventTouchUpInside]; 回答1: control targets only accept one argument for their actions: the control that's being manipulated. There's no way to do what you want (the OS just doesn't support it). 回答2: What are you trying to put in there? Maybe you can use the tag property, or if that's not sufficient, subclass UIButton and

Using `valueForKey` to access view in UIBarButtonItem, private API violation?

戏子无情 提交于 2020-01-10 03:51:05
问题 Since UIBarButtonItem doesn't subclass UIView , it's impossible to get at the normal characteristics like its frame . One way to do this is [barButtonItem valueForKey:@"view"] This works perfectly, and allows you to add a GestureRecognizer (for instance) to the underlying UIView . However, is this a private UIKit API violation? 回答1: This is not private in terms of immediate rejection upon validation, but it's private enough to be considered fragile (that is, new iOS version can break your

Changing the delete accessory view in a UITableViewCell

为君一笑 提交于 2020-01-09 18:38:28
问题 Is it possible to change the view shown in response to a left to right "I want to delete this row" swipe in a UITableView's UITableViewCell? Currently the 'delete' button seems to ignore all of the other UITableViewCell customisation options. 回答1: The tricky thing about deleting cells is this: when you swipe left to right to show the "delete" button, the UITableViewCell moves to the UITableViewCellStateShowingDeleteConfirmationMask state, but doesn't set its UITableViewCellStateEditingMask

Changing the delete accessory view in a UITableViewCell

…衆ロ難τιáo~ 提交于 2020-01-09 18:35:52
问题 Is it possible to change the view shown in response to a left to right "I want to delete this row" swipe in a UITableView's UITableViewCell? Currently the 'delete' button seems to ignore all of the other UITableViewCell customisation options. 回答1: The tricky thing about deleting cells is this: when you swipe left to right to show the "delete" button, the UITableViewCell moves to the UITableViewCellStateShowingDeleteConfirmationMask state, but doesn't set its UITableViewCellStateEditingMask

Changing the delete accessory view in a UITableViewCell

放肆的年华 提交于 2020-01-09 18:34:09
问题 Is it possible to change the view shown in response to a left to right "I want to delete this row" swipe in a UITableView's UITableViewCell? Currently the 'delete' button seems to ignore all of the other UITableViewCell customisation options. 回答1: The tricky thing about deleting cells is this: when you swipe left to right to show the "delete" button, the UITableViewCell moves to the UITableViewCellStateShowingDeleteConfirmationMask state, but doesn't set its UITableViewCellStateEditingMask

Is there a way to remove the separator line from a UITableView?

允我心安 提交于 2020-01-08 19:41:29
问题 I'm looking for a way to completely remove the separator line in a UITableView when in the plain mode. This is done automatically in grouped, but this also changes the dimensions of the table in a way that is hard to measure. I have set the seperator line color to colorClear. But this does not completely solve the problem. As I am trying to draw a custom background view in the cells, and I want the cells to be seamless, the one pixel line that remains in-between is causing me problems. Is