Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

newText problem
Started by thanakorn.t Nov 01 2018 02:48 AM

5 replies to this topic
text ios
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

thanakorn.t

[GLOBAL: userInfoPane.html]
thanakorn.t
  • Observer

  • 8 posts
  • Corona SDK

Sorry, I have a problem with newText when I build my application and run on iOS ver.11.4.1 or above. The text use display.newText cut off from full text but if run on Android or Simulator text isn't cut off.

 

I used Corona SDK ver.2018.3424

            local options = {
                text = params.guidetripArticle,
                x = myApp.width * 0.05,
                y = date.y + date.height + 10 * myApp.stdHeight,
                width = myApp.width * 0.9,
                font = myApp.mainFont,
                fontSize = 14
            }
            local detail = display.newText( options )
            detail:setTextColor(91/255)
            detail.anchorX = 0
            detail.anchorY = 0
            scrollView:insert(detail)

This is my code and text sent by API 



[TOPIC: post.html]
#2

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 293 posts
  • Corona SDK

I'm using 2018.3410 and I don't have any issues with display.newText(). Unless something has happened, then I guess that your issue lies with faulty parameters, which I can't test for.

It is possible that one or more of those parameters is nil or a much higher value than you expect. In this case, we are most likely talking about the value for width. For testing purposes, try replacing that (or all values) with just a number and see if it starts working. If it starts working, then the problem lies with your parameters. For debugging, it's best to print out all their values to see which one isn't working.



[TOPIC: post.html]
#3

thanakorn.t

[GLOBAL: userInfoPane.html]
thanakorn.t
  • Observer

  • 8 posts
  • Corona SDK

b6a4c7687452694833b4f08a7c66195b.jpg

This is my text on Database and red arrow show position cut off 

 

fe186fa04b52522c8f4d155f9e1bacdf.jpg

This is my screen on iPhone 6 and end of text is "The most".



[TOPIC: post.html]
#4

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 293 posts
  • Corona SDK

Ah, I completely misunderstood you. I thought you meant that the text just keeps going and going, not respecting the width value set in the options. The pictures definitely help. :D

I'm not sure what the problem might be. The documentation reads:

"When rendering a multi-line box of text, be careful that the final display object does not exceed any target device's maximum texture size limit. If you need to render text objects with a large number of lines, you should create multiple text objects and position them one after the next."

 

Perhaps the extra text is being cut off due to device limitations, which would mean that you need to cut the text into multiple text objects. Maybe someone else will know definitely what the answer is.



[TOPIC: post.html]
#5

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 24,860 posts
  • Corona Staff

It might be worth reading this tutorial: http://docs.coronalabs.com/tutorial/system/textBlocks/index.html

 

But you're inserting it in a scrollView is it a case you just need to scroll the screen to see the rest of the text?

 

Rob



[TOPIC: post.html]
#6

thanakorn.t

[GLOBAL: userInfoPane.html]
thanakorn.t
  • Observer

  • 8 posts
  • Corona SDK

It's work. Thank you very much   ^_^




[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: text, ios