开发者

UITextView does not display my text

I have a list of images (jpg) that I am displaying in the detailView and each image has a corresponding text file with information about the image. I am trying to use a UITextView to display the contents of the text file, but I have trouble getting it to display anything at all. I have made my text view read-only as I do not want to contents of my .txt files to be editable. This is what I have:

     NSString *file = [[NSBundle mainBundle] pathForResource:@"%@" ofType:@"tx开发者_运维百科t"];
     if (file){
       NSString *textFromFile = [NSString stringWithContentsofFile:file];
       textView.text = textFromFile;
     }


I think that you probably want to use a label to display small snippets of non-interactive text. Afterwards make sure that you link the UI component you decide on with the File Owner in order to actually connect your variable declaration in the code to the UI component. Let me know how this goes!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜