I was wondering how WhatsApp handles the time shown in every message.
For those who don't know:
If the message is very short, the text and time are in the same row. (tine in the end of row)
If the message is long, the time is in the bottom right corner - the text wrapped around it.
if you have some idea how to do it please let me know
Here is the requested screenshot (please ignore checkmarks):
You can use a single attributed string with different text attributes for the main message, and the timestamp. iOS will then internally do all this for you automatically.
Otherwise you can use exclusion paths which are a part of TextKit.
Related
I am currenlty working on an ios project where I need to have a text field that can have the placeholder wrapped in it whenever needed
The placeholder is being taken as a user input so at times the text can be long and can extend to a couple of lines.
I tried this UITextView.placeholderLabel.numberOfLines = 0; which doesnt seem to do the job.
Any good documentation would or references would be helpful too
On iOS 10 in a UILabel, the letter יִ (a yud with a chirik under it) is getting displayed as a circle instead of the way it's supposed to appear.
Other vowels and letters (e.g. יֵ יַ יֶ יֹ) are being displayed ok.
I submitted this as a bug to apple (bug id 28561355 on https://bugreport.apple.com).
Even if apple can fix this in a future version of iOS, is there anything I can do now, to hack this to work? I can just replace the yud-chirik with a plain yud, but I'd rather try and keep the display as it's supposed to be.
Thanks.
UPDATE: It seems that if I change the font to the default apple font (instead of a custom font that I was using), then the yud-chirik appears, but the chirik appears in the wrong place. It appears directly under the yud instead of at the bottom with all the other vowels.
I want to add a search field inside my custom keyboard that allows the user to search for content which can then be input into the main text document for which the keyboard is being displayed.
However, calling -becomeFirstResponder on the UITextField object causes a 3-4 second lag during which no input is accepted. The same thing happens if I call -resignFirstResponder. I can set the text property of the text field just fine, but that means that there is no caret, and the text is truncated to fit.
On calling (become|resign)FirstResponder, I get the following messages in the log:
2014-10-28 13:39:50.920 Giffy KB[2073:514844] Received 0 images
2014-10-28 13:39:57.942 Giffy KB[2073:514745] <_UIRemoteInputViewController: 0x14762a030> timed out waiting for fence barrier from com.theappical.giffage.giffagekb
2014-10-28 13:39:58.446 Giffy KB[2073:514745] View service did not balance fencing 'begin' messages with 'end' messages within a second; timing out.```
Other third party keyboards seem not to use textfields (they use custom views instead). Does that mean this is a bug at Apple's end, or is there something I can do to resolve it?
Filed a bug report with Apple for the same, ended up faking a text field using a UILabel. As of now (iOS 8.1 latest), this issue has yet to be resolved.
I am currently using iOS 8's provided keyboard extension's textDocumentProxy.documentContextBeforeInput to get the text that a user has entered in order to perform some sort of modification to it.
I noticed that while the method documentContextBeforeInput would work fine for any chucks of texts, as soon as periods "." are inserted, documentContextBeforeInput is only able to return text that occurs after the period.
For example, testing the following text: "This is sentence 1. And this is sentence 2" When using documentContextBeforeInput with placing the cursor at the end, it will only return "And this is sentence 2", and not the entire text that has come before it.
Has anyone also encountered this issue, and if so have you discovered a workaround?
Thanks!
Trying to increase the size of a UITextView programmatically depending on what text has been inputted into it. The problem is, textViewDidChange: will only recognize new line characters if I input something after inputting them. For example, I'm trying to input the following:
Hi, my\n name is Jimmy.
This is what I'll get if I print this in NSLog in textViewDidChange:
Log: H
Log: Hi
Log: Hi,
Log: Hi, m
Log: Hi, my
Log: Hi, my (here goes the new line, but it's not recognized)
Log: Hi, my
n (it's recognized on this line, only after something is inputted after it).
If I try to input two newlines, only the first one will be recognized and only after I input the second one. Is this some sort of a bug or am I missing something, is there a way to fix this? This used to work properly on iOS 6.
EDIT --
To clarify the problem a bit more, I do get notified that the text has been changed, the problem is the new text is an empty character instead of new line.
EDIT --
It seems that currently the only proper way to find the fitting size for UITextView is by using its sizeThatFits: method while passing it the bounding size. Also if you're changing UITextView's proportions programmatically, it would be wise to remove any autoresizing masks from it.
Works for me on both iOS 6 and iOS 7. Keep in mind that NSLog will sometimes not show new lines at the end of log like you would expect, so try to log something else after textView.text, for example:
- (void)textViewDidChange:(UITextView *)textView
{
NSLog(#"TextView text changed to: \"%#\"", textView.text);
}
If it really doesn't log new lines, then it does sound like a bug that you should report.