Currently I am testing one iOS app for localization.
Is there any way we can take a screenshot of the app screen and we extract a text from that screenshot to compare it with the text coming from the locale string file?
To assert texts use accessibility properties of XCUIElement (value and title)
https://developer.apple.com/documentation/xctest/xcuielementattributes
Watch the example here
https://github.com/rzakhar/xctest-assignment
To access translations in your tests refer to a Comparing localized UI texts tip from here
https://www.vvse.com/blog/blog/2018/01/24/tips-for-using-xcodes-ui-testing-solution-xcuitest/
Make sure to write some extensions to reduce boilerplate code
I have the following international text in my react native app:
<Text>ᚘᚘᚘ</Text>
However, a blank line is displayed to my screen where the text should go. I have tried for other international characters as well and it is the same result.
I am using notepad++ and making sure that encoding is set to UTF-8. If I use console.log("ᚘᚘᚘ") it displays to the console just fine. Do I specifically need to embed a particular unicode font in my React Native project for it to work correctly? Or what should I be doing so that it displays my text correctly?
On further investigation I am using a Samsung Galaxy S2 for testing purposes. It does not seem to handle unicode characters in all applications, so I think my app will not work in older devices unless I specifically embed a Unicode font. Am I correct in my thinking?
The only solution I found to this was to add a custom font. This link explains how to use a custom font: https://blog.bam.tech/developper-news/add-a-custom-font-to-your-react-native-app . The font I used is called GNU FreeFont located here: https://www.gnu.org/software/freefont/
I have made an app which has several custom fonts, but i'm struggling to make it work on ios6 devices, i have added them in myApp-Info.plist and it works without any problem on labels and buttons and everywhere except uiwebviews in ios7 , but in ios 6 it looks like the default font in everywhere and there is no change throughout the whole app in fonts. After searching couple of weeks, still haven't find any answer that would work.
Here is my code for assigning a font to label :
titleLable.font=[UIFont fontWithName:#"B Yekan" size:17];
I just encountered this problem, also, and found that in iOS 7, font names aren't case-sensitive; i.e., I was trying to use "ChunkFive-Roman", which worked in iOS 7 even though my code said "Chunkfive-Roman".
However, this doesn't work in iOS 6... I was getting the default font instead. Changing the font name to "ChunkFive-Roman" fixed it so that that the text was appearing correctly in both. (Note -- was using Simulator in both cases).
You have to follow the rules in this link, once you do it there u go..
Add your custom font into your project , i.e. Dragged the font's ttf file (CALIBRIZ_0.TTF) into your resource folder from finder and check the "copy file to project folder" option. )
Edit Info.plist: Add a new entry with the key Fonts provided by application.
For each of your files, add the file name to this array (Fonts provided by application)
Now set font to your label:
MyLabel.font = [UIFont fontWithName:#"Calibri" size:16];
http://blog.builtwithlogic.com/post/73503283890/installing-custom-fonts-on-iphone-and-ipad-ios-devices
Covers how to add fonts - Little confused though by your question you specifically mention iOS6 as the problem and UIWebView - Be interested to know what you mean by that piece?
Have you tried setting the fonts using UIAppearance ? or are you subclassing and amending the fonts as it could be that you've not done it right there. Could you supply some code showing how you setting you custom fonts throughout the app?
If you haven't already I'd ensure you've followed the steps in that email and then add a custom category to UIFont to pass back a specific font. If you haven't already done so I would also set the fonts in UIAppearance for your labels, Titles etc this is the cleanest and most efficient way to do it throughout your application as you only need set it one and you can set differently based on how a for example Label is presented -in a tableview in a navigation bar etc.
here's a link to the official docs
https://developer.apple.com/library/ios/documentation/uikit/reference/UIAppearance_Protocol/Reference/Reference.html
Appreciate this question is old but love to know if that helps.
I had a similar problem where the custom font would work in iOS7, but not iOS6.
The solution for me was to use the true font name not the filename.
To do this check the font name as shown in OSX's FontBook.
iOS7 allowed me to use the the filename (less the .ttf suffix), but iOS6 wanted the true font name as shown in FontBook.
For example for a font named CustomFont.ttf .....
I followed all the steps listed by others here to add the font to my app, but then used it by referencing it as #"CustomFont".
When I added the font to my mac and looked at it in FontBook (mac utility), it was actually named #"Custom font" - with a space and a lower case letter.
Hopefully this helps someone else out there :-)
iOS 6 cannot do custom fonts. That is a new feature only available in iOS 7.
I need to use Multiple textAlignments in single UITextView i.e. one para LeftAligned and other Para Right.
I achieved this using NSMutableAttributedString but that's only for iOS 6 as it's crashing on devices with older OS. I am looking for some solution which works on previous iOS versions too. Ideally iOS4.3 compatible solutions. I had checked several solutions uploaded on SO here but couldn't find which does set multiple alignments to be exact. May be due to my little knowledge regarding core text, I am unable to use it. Some specific help with sample code will help much.
Thanks
If you are only displaying the text (without editing), you could use a UIWebView and CSS for text styling.
I am working on the PDF App for iPad and facing an issue: how to search a text in PDF and also how to highlight that text?
Yours is the same big problem I'm having. My understanding is that, currently on iOS 4.0, the main public API is CGPDF . It allows us to parse PDF, and with it we can search strings in it. See also this Quartz 2D document. It also allows us to render it on the screen using CGContextDrawPage. However, it's not yet possible to get the position of a text in the rendered image. (On OS X it's possible using PDFKit.)
So, I'm afraid that you need to implement the PDF spec yourself to get that info. I think GoodReader etc. is working very very hard to implement these.
I had the same trouble recently and then I found FastPDFKit. Have tested the package and it's working great.
http://mobfarm.eu/fastpdfkit