cocoa-touch

Handling keyboard with bottom constraint

心不动则不痛 提交于 2021-01-28 08:06:08
问题 I'm building a chat app with a regular design and UI of a chat app. I have a "toolbar" that my app needs (0,0 375x66) and I want it to stay where it is when the keyboard is shown. It has 4 constraints: top: 0, leading: 0, trailing: 0, aspect-ratio: 125:22 I have a UICollectionView (0,66 375x530) that I want to be scrolled like any other chat app when the keyboard is shown. It has 4 constraints: top (to the toolbar): 0, leading: 0, trailing: 0, bottom (to the newMessageView I'll explain

How I can restrict position view while moving/dragging on PDFView? (Swift)

六月ゝ 毕业季﹏ 提交于 2021-01-28 07:58:45
问题 I took one custom view (SignatoryView) on pdf, When I click on Add button from Navigation bar, it will add that SignatoryView on PDF view and according to my choice I can move/drag that signatory view to any location. Problem : When I am moving that signatory view on pdf, it is going outside edges of pdfView. (Left, right, bottom and top also) Here is the demo : It should not go beyond its boundaries, it should be movable only inside edges on PDF view. How I can achieve this ? Here is the

How can I find the UIFont pointSize necessary to get a desired lineHeight or other metric?

家住魔仙堡 提交于 2021-01-28 03:02:44
问题 You can ask a UIFont instance for its lineHeight metric: UIFont *const font = [UIFont systemFontOfSize: 10]; CGFloat lineHeight = [font lineHeight]; If I want a particular lineHeight, (20, say), how can I create a UIFont with that size? 回答1: Answer My limited analysis suggests, surprisingly to me, that linear interpolation can be used. Here's a category on UIFont that will do what's needed: @interface UIFont (FontWithLineHeight) +(UIFont*) systemFontWithLineHeight: (CGFloat) lineHeight; @end

How to judge NSEvent from trackpad click, not tap to click

前提是你 提交于 2021-01-27 13:00:42
问题 When "tap to click" checked, how judge NSEvent is from trackpad click(pressed down) or tap to click. - (void)mouseEvent:(NSEvent*)theEvent { if ((type == NSLeftMouseUp || type == NSLeftMouseDown) && [theEvent subtype] == NSEventSubtypeTouch) { // How to detect touchpad is real pressed?? Not tap to cllick } } 回答1: To find out if someone only "tap to click" you could use func pressureChange(with event: NSEvent) in your NSViewController on NSView. If someone only "tap" the function will not be

How do I make UITableViewCellAccessoryDisclosureIndicator visible in black background?

做~自己de王妃 提交于 2021-01-27 03:53:51
问题 cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; in this method - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath; but I can only see it when I select that cell otherwise it's not visible.and it work perfectly when background is white. I am sure that I need to set a property, but I don't know which property I need to change to make this thing work. thanks in advance. cheers. 回答1: It would appear that the disclosure

How do I make UITableViewCellAccessoryDisclosureIndicator visible in black background?

半腔热情 提交于 2021-01-27 03:51:28
问题 cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; in this method - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath; but I can only see it when I select that cell otherwise it's not visible.and it work perfectly when background is white. I am sure that I need to set a property, but I don't know which property I need to change to make this thing work. thanks in advance. cheers. 回答1: It would appear that the disclosure

UITextView custom spelling and autocorrect

主宰稳场 提交于 2021-01-27 02:56:16
问题 I want to make an iOS text editor for a certain rare human language, and I want it to support my own spell checking and autocorrect systems for that language. In iOS, is it possible to get UITextView to use a custom spell checker and autocorrect system, rather than those of the system's current locale? Or do I have to resort to creating a text view from scratch using Core Text? 回答1: I don’t think there’s a way to actually change the spell-checking mechanism of UITextView . A good approach

Preprocessor macro value to Objective-C string literal

 ̄綄美尐妖づ 提交于 2020-12-27 08:38:30
问题 I have a preprocessor macro defined in build settings FOO=BAR That value I want to massage into an Objective-C string literal that can be passed to a method. The following #define does not work, but it should demonstrate what I am trying to achieve: #define FOOLITERAL @"FOO" //want FOOLITERAL to have the value of @"BAR" myMethodThatTakesAnNSString(FOOLITERAL); I expect that I am just missing the obvious somehow, but I cannot seem to find the right preprocessor voodoo to get what I need. 回答1: