Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8205733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T08:22:26+00:00 2026-06-07T08:22:26+00:00

I’m porting an iPhone app that uses this tutorial into a Mac app. I’ve

  • 0

I’m porting an iPhone app that uses this tutorial into a Mac app. I’ve been able to get text to display in NSScrollView, but I can’t get the text to scroll and I hope someone knows what I am missing.

In the iPhone app, CTView is subclassed from UIScrollView

CTView.h:

@interface CTView : UIScrollView <UIScrollViewDelegate> {

1) But there is no NSScrollViewDelegate in AppKit. Is the missing delegate interface to NSScrollView the problem?

So for the Mac app, CTView.h looks like the following:

@interface CTView : NSScrollView 

In CTView.m I have

[self setHasHorizontalScroller:YES];
[self setAcceptsTouchEvents:YES];

Also inside CTView.m I create a NSMutableArray of frames as

self.frames = [NSMutableArray array];

and fill the array up with frames. I also set the frame for the document view for the complete larger image that I want to be able to scroll through as:

[[self contentView] setFrame:[self bounds]];
[self.documentView setFrame:  NSMakeRect(0, 0, totalPages * self.bounds.size.width, textFrame.size.height)];

The first frame is visible in the CTView, but when I move the horizontal scroll bar, the second frame doesn’t show up in CTView.

I’m using Xcode 4.3.3 and Mac OS X 10.7.4.

Does anyone know what I need to do differently from UIScrollView for NSScrollView to be able to scroll through the frames?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T08:22:28+00:00Added an answer on June 7, 2026 at 8:22 am

    Finally figured it out. Whew!

    1) NSScrollView needs a view for its documentView, where the documentView is what is scrolled over. So in the nib I created a NSScrollView that contained a view for the documentView and set the documentView to that view as shown by the code in CTView.m

    NSArray *viewArray     = [self subviews];
    NSArray *docViewArray  = [[viewArray objectAtIndex:0] subviews]; 
    NSView  *docView       = [docViewArray objectAtIndex:0];
    
    [self setDocumentView:docView];
    

    2) Then I added the array of frames, that would normally be added to UIScrollView, to the documentView of NSScrollView. The array of frames consists of multiple elements of content.

     while (textPos < [attString length]) { 
        CTFrameRef frame = CTFramesetterCreateFrame(framesetter, CFRangeMake(textPos, 0), innerPath, NULL);
        CFRange frameRange = CTFrameGetVisibleStringRange(frame); 
    
       CTColumnView* content = [[[CTColumnView alloc] initWithFrame: NSMakeRect(0, 0, self.contentSize.width, self.contentSize.height)] autorelease];
        [docView addSubview: content];  // <<-- Here is where the frames are added to the documentView
        textPos += frameRange.length;
      }
    

    And that did the trick.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to understand how to use SyndicationItem to display feed which is
I have a jquery bug and I've been looking for hours now, I can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.