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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:47:32+00:00 2026-06-04T01:47:32+00:00

hello Buddies , I have used UIButton as subview to UILabel and I m

  • 0

hello Buddies , I have used UIButton as subview to UILabel and I m opening some popup on click of that button and I found that the popup is opening away from that button What is the reason behind it , Help Please.. Thank You!
My code is as follows:

    sortBtn = [UIButton buttonWithType:UIButtonTypeCustom];
 [sortBtn setTitle:@"Sort" forState:UIControlStateNormal];
 [sortBtn setBackgroundColor:[UIColor colorWithRed:0.137 green:0.384 blue:0.871 alpha:1.0]];
 [sortBtn.titleLabel setFont:[UIFont boldSystemFontOfSize:16.0f]];
 [sortBtn addTarget:self action:@selector(sortTheData:) forControlEvents:UIControlEventTouchUpInside];

  sortBtn.frame=CGRectMake(195,5, 53, 28);

 [categoryLabel setUserInteractionEnabled:YES];
 [categoryLabel addSubview:sortBtn];

sorttheData Method is as follows:

SortByController *sortController = [[SortByController alloc] initWithNibName:@"SortByController" bundle:nil];
sortController.dataArray = self.dataAllPerformances;
sortController.sortString =self.sortString;
sortController.genreId = [NSString stringWithFormat:@"%d",self.genreId];
sortController._delegate = self;
self.popController = [[UIPopoverController alloc] initWithContentViewController:sortController];
//popController.delegate = self;
popController.popoverContentSize = CGSizeMake(230, 260);
[popController presentPopoverFromRect:sender.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
[sortController release];
  • 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-04T01:47:34+00:00Added an answer on June 4, 2026 at 1:47 am

    The reason for this is you are adding your button in categoryLabel not in view while presenting the popover in self.view.

    try following:

    CGRect rect = [self.view convertRect:[sortBtn frame] fromView:self.view];
    [popController presentPopoverFromRect:rect inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
    

    this will get your button’s frame in respect to self.view storing in rect type of CGRect (frame is also type of CGRect). Than while presenting popover pass this new rect in place of sender.frame as sender.frame has its x,y according to the categoryLabel.

    hope this helps 🙂

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

Sidebar

Related Questions

Hello I have this problem with PyQt4-dev-tools that include: * a user interface compiler
Hello dearest community. I have trouble in the last two days, that I can't
Hello frnds I have windows mobile application, that retrieves location info. Now i want
hello i have a app that connects and post to user wall but when
Hello I have an example that works properly: $(function() { $(#treegrid).jqGrid({ url: 'tree2.json', datatype:
Hello fellow earthlings, I have an image as my background that I created in
Hello I have a tab widget that extends the customer edit page. In one
Hello Stackoverflowers! I have written a relatively simple application that consists of a login
Hello I have like this 2 tables class User public int UserId{get;set;} { ....
hello all i am working on a project in which i have a webpage

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.