Well, I have just started programming in cocoa after doing a lot of procedural c in mac os 9. I think that the ideas behind the object approach are neat, but they are taking a lot more time to learn than I had hoped. I have a question specifically about the text view object. I am practicing coding in this language by making a simple text-based rpg with the text display in a text view. Becuase I couldn't figure out how to add text I made up this method which other than the problem that I will get to works quite well:
- (void)addtexttodisplayNSString *)textToAdd
{
originaltext = [displayText string];
totaltext = [NSString stringWithFormat: @"%@%@",originaltext,textToAdd];
[displayText setString:totaltext];
}
I simplay call this function to add text to the object displayText which is a NSTextView. My main problem is that when the program outputs enough text, there becomes the necessity to scroll, and I can't figure out how to get the program to automatically go to the last line in the text. It requires that the user scroll down manually. If you have any idea how to help solve my problem please help me Thanks.
- (void)addtexttodisplayNSString *)textToAdd
{
originaltext = [displayText string];
totaltext = [NSString stringWithFormat: @"%@%@",originaltext,textToAdd];
[displayText setString:totaltext];
}
I simplay call this function to add text to the object displayText which is a NSTextView. My main problem is that when the program outputs enough text, there becomes the necessity to scroll, and I can't figure out how to get the program to automatically go to the last line in the text. It requires that the user scroll down manually. If you have any idea how to help solve my problem please help me Thanks.