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 6132723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:08:17+00:00 2026-05-23T17:08:17+00:00

I’m having some trouble with autoresizing masks. Here’s the deal: I’m using the recently

  • 0

I’m having some trouble with autoresizing masks. Here’s the deal: I’m using the recently released TwUI, which takes a lot from UIKit, but it’s on the Mac. That’s why I tagged for both iOS & Mac. So, I create a view that needs to have 40px of margin on the bottom, no matter how large the window is resized vertically. I’m not allowing horizontal expansion of the window, for multiple reasons. Here’s what a sample looks like of what I’m talking about. Sorry for the ugly appearance, I’m just using sample views to test.

enter image description here

Right ho, so see the 40px of black space on the bottom?

I’m creating the red view by doing something like this:

CGRect b = self.view.bounds;
b.origin.y += TAB_HEIGHT; //40px
b.size.height -= TAB_HEIGHT;

Then I’m creating the view with that frame.

However, as soon as I try to add autoresizing masks on the red view it loses bottom 40px, and just fills the whole view. For those unfamiliar with TwUI, a sample autoresizing mask looks like this:

view.autoresizingMask = TUIViewAutoresizingFlexibleHeight;

So, the autoresizing masks take after their iOS counterparts. However, setting that mask does this:

enter image description here

So my question is, how can I keep a margin on the bottom of this view?

  • 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-05-23T17:08:18+00:00Added an answer on May 23, 2026 at 5:08 pm

    @Rob, I have got no trouble autoresizing it.

    The following code was what I modified an empty project with TwUI github trunk.

    - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
    {
        // Insert code here to initialize your application
        TUINSView *content = [[TUINSView alloc] initWithFrame:CGRectZero];
        CGRect b = [window frame];
        b.origin = CGPointZero;
        content.frame = b;
    
        [window setContentView:content];
        TUIView *viewA = [[TUIView alloc] initWithFrame:CGRectZero];
        viewA.frame = content.bounds;
        viewA.backgroundColor = [TUIColor blackColor];
        [content setRootView:viewA];
        viewA.autoresizingMask = TUIViewAutoresizingFlexibleSize;
        TUIView *viewB = [[TUIView alloc] initWithFrame:CGRectZero];
        viewB.backgroundColor = [TUIColor redColor];
        b = viewA.bounds;
        b.origin.y+=30;
        b.size.height-=30;
        viewB.frame = b;
        [viewA addSubview:viewB];
        viewB.autoresizingMask = TUIViewAutoresizingFlexibleSize;
    }
    

    EDIT:
    I coded my TUIViewController’s loadView like this, it works so far so well.

    - loadView {
        TUIView *v = [[TUIView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
        tableView = [[TUITableView alloc] initWithFrame:v.bounds style:TUITableViewStylePlain];
        [tableView scrollToTopAnimated:NO];
        tableView.autoresizingMask = TUIViewAutoresizingFlexibleSize;
        document = [[BBSDocDocument alloc] init];
        tableView.delegate = self;
        tableView.dataSource = self;
        CGRect rect = [v bounds];
        [v addSubview:tableView];
        [self setView:v];
    }
    

    EDIT 2:
    My code with TUIViewController subclass:

    //TestVC.h:
    
    #import <Foundation/Foundation.h>
    #import "TUIKit.h"
    
    @interface TestVC : TUIViewController {
    @private
        TUIView *viewA;
    }
    - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil;
    @end
    
    
    //TestVC.m
    @implementation TestVC
    
    - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
    {
        self = [super initWithNibName:nil bundle:nil];
        if (self) {
            // Initialization code here.
        }
    
        return self;
    }
    
    - (void)loadView {
        self.view = [[[TUIView alloc] initWithFrame:CGRectZero] autorelease];
        self.view.autoresizingMask = TUIViewAutoresizingFlexibleSize;
    }
    
    
    //application delegate:
    - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
    {
        // Insert code here to initialize your application
        TUINSView *content = [[TUINSView alloc] initWithFrame:CGRectZero];
        CGRect b = [window frame];
        b.origin = CGPointZero;
        content.frame = b;
    
        [window setContentView:content];
        TUIView *viewA = [[TUIView alloc] initWithFrame:CGRectZero];
        viewA.frame = content.bounds;
        viewA.backgroundColor = [TUIColor blackColor];
        [content setRootView:viewA];
        [viewA setAutoresizingMask:TUIViewAutoresizingFlexibleSize];
        TUIView *viewB = [[TUIView alloc] initWithFrame:CGRectZero];
        viewB.backgroundColor = [TUIColor redColor];
        b = viewA.bounds;
        b.origin.y+=30;
        b.size.height-=30;
        viewB.frame = b;
        [viewA addSubview:viewB];
        viewB.autoresizingMask = TUIViewAutoresizingFlexibleSize;
        TestVC *testVC = [[TestVC alloc] initWithNibName:nil bundle:nil];
        testVC.view.frame = viewB.bounds;
        testVC.view.backgroundColor = [TUIColor yellowColor];
        [viewB addSubview:testVC.view];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
We're building an app, our first using Rails 3, and we're having to build
I know there's a lot of other questions out there that deal with this
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I am using the SimpleRSS gem to parse a WordPress RSS feed. The only

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.