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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:42:41+00:00 2026-06-04T03:42:41+00:00

I’m placing a view (viewB) over the top of another view (viewA). The lower

  • 0

I’m placing a view (viewB) over the top of another view (viewA). The lower viewA has two buttons, btn1 can be clicked and btn2 can not. Ideally I would like to pass the click propagation from viewB to btn2.

I realise the problem is to do with the zIndex on viewB being higher then viewA, which means btn2 is technically behind it, although the button is fully visible.

It there anyway to pass the click propagation down without restructuring it?

This is a very simplified version of the real code and simply adding btn2 to viewB is not possible, the exact position of btn2 in the real code is unknown, it’s a child of a number of other views all with their own tops and lefts.

If it’s not possible I’m equally interested in hearing that. Thanks.

Build for iPhone/iPad
Ti.SDK 2.0.2.v20120417133255
Ti.Studio 2.0.1
xCode 4.3.2


var w

in = Titanium.UI.createWindow({  
    backgroundColor:'#fff'
});

var viewA = Ti.UI.createView({
        backgroundColor: '#DDD',
});

var btn1 = Ti.UI.createButton({
        top: 50,
        title: 'Click 1',
        height: 50,
        width: 150,
        zIndex: 100,
});
btn1.addEventListener('click', function(){
        alert('click 1');
});
viewA.add(btn1);


var btn2 = Ti.UI.createButton({
        top: 150,
        title: 'Click 2',
        height: 50,
        width: 150,
        zIndex: 100,
});
btn2.addEventListener('click', function(){
        alert('click 2');
});
viewA.add(btn2);

var viewB = Ti.UI.createView({
        top: 120,
        zIndex: 20,
        borderWidth: 1,
        borderColor: '#0000FF',
        // backgroundColor: '#0000FF',
        // opacity: 0.5
});

win.add(viewA);
win.add(viewB);


win.open();
var win = Titanium.UI.createWindow({  
    backgroundColor:'#fff'
});

var viewA = Ti.UI.createView({
        backgroundColor: '#DDD',
});

var btn1 = Ti.UI.createButton({
        top: 50,
        title: 'Click 1',
        height: 50,
        width: 150,
        zIndex: 100,
});
btn1.addEventListener('click', function(){
        alert('click 1');
});
viewA.add(btn1);


var btn2 = Ti.UI.createButton({
        top: 150,
        title: 'Click 2',
        height: 50,
        width: 150,
        zIndex: 100,
});
btn2.addEventListener('click', function(){
        alert('click 2');
});
viewA.add(btn2);

var viewB = Ti.UI.createView({
        top: 120,
        zIndex: 20,
        borderWidth: 1,
        borderColor: '#0000FF',
        // backgroundColor: '#0000FF',
        // opacity: 0.5
});

win.add(viewA);
win.add(viewB);


win.open(
);

  • 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-04T03:42:43+00:00Added an answer on June 4, 2026 at 3:42 am

    I’m sure after I answer this and have implemented the solution in my app someone will have come back with a better way!

    I looked at a couple of ways to solve this, finding the exact position of btn2 and adding it to view2, auto heights would often cause problems and it would end up within +-20px. Not good enough.

    The solution I went with was to punch a hole in the view2 layer by creating view2 from a number of other views (topView, leftView, rightView and bottomView), these would then be buffered up to each other with a hole being left where btn2 is located. This solution severely surfers from scalability. Add a btn3, btn4… the number of views needed to create view2 becomes increasingly more and increasingly more difficult to layout.

    I’m aware of the shortcomings of this solution and only suggest it as an option until something better can be found.

    • 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 ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
In my XML file chapters tag has more chapter tag.i need to display chapters
Does anyone know how can I replace this 2 symbol below from the string

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.