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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:49:45+00:00 2026-05-14T05:49:45+00:00

I am creating a nav-based app with a view that floats at the bottom

  • 0

I am creating a nav-based app with a view that floats at the bottom of the screen (Alpha .7 most of the time).

I create it like this…

// stuff to create the tabbar/nav bar.
// THIS ALL WORKS...
// then add it to subview.

[window addSubview:tabBarController.view];

// need this last line to display the window (and tab bar controller)
[window makeKeyAndVisible];

// Okay, here is the code i am using to create a grey-ish strip exactly `zlocationAccuracyHeight` pixels high at `zlocationAccuracyVerticalStartPoint` starting point vertically.

CGRect locationManagerAccuracyUIViewFrame = CGRectMake(0,zlocationAccuracyVerticalStartPoint,[[UIScreen mainScreen] bounds].size.width,zlocationAccuracyHeight);
self.locationManagerAccuracyUIView = [[UIView alloc] initWithFrame:locationManagerAccuracyUIViewFrame];
self.locationManagerAccuracyUIView.autoresizingMask = (UIViewAutoresizingFlexibleWidth);
self.locationManagerAccuracyUIView.backgroundColor = [UIColor darkGrayColor];
[self.locationManagerAccuracyUIView setAlpha:0];

CGRect locationManagerAccuracyLabelFrame = CGRectMake(0, 0,[[UIScreen mainScreen] bounds].size.width,zlocationAccuracyHeight);
locationManagerAccuracyLabel = [[UILabel alloc] initWithFrame:locationManagerAccuracyLabelFrame];

if ([myGizmoClass useLocationServices] == 0)
{
 locationManagerAccuracyLabel.text = @"GPS Accuracy: Using Manual Location";
}
else 
{
 locationManagerAccuracyLabel.text = @"GPS Accuracy: One Moment Please...";
}

locationManagerAccuracyLabel.font = [UIFont boldSystemFontOfSize:12];
locationManagerAccuracyLabel.textAlignment = UITextAlignmentCenter;
locationManagerAccuracyLabel.textColor = [UIColor whiteColor];
locationManagerAccuracyLabel.backgroundColor = [UIColor clearColor];
[locationManagerAccuracyLabel setAlpha:0];
[self.locationManagerAccuracyUIView addSubview: locationManagerAccuracyLabel];
[window addSubview: self.locationManagerAccuracyUIView];

this all works (i am not sure about the order i create the uiview in … meaning i am creating the frame, the view, creating the “accuracy text” and adding that to the view, then adding the uiview as a subview of the window . It works and seems correct in my logic.

So, here is the tough part.

I have a timer that i am testing with. I am trying to float the uiview up by 30 pix.

here is that code:

[UIView beginAnimations:nil context:NULL];  
[UIView setAnimationDuration:0.3];  
CGRect rect = [ self.locationManagerAccuracyUIView frame];
NSLog(@"ORIGIN: %d x %d (%@)\n",rect.origin.x,rect.origin.y,rect);
rect.origin.y -= 30;
[UIView commitAnimations];

The problem? rect is nill, rect.origin.x and rect.origin.y are both zero.

Can anyone tell me why?

Here is how i set up self.locationManagerAccuracyUIView in my files:

Delegate.h

UIView     *locationManagerAccuracyUIView;
UILabel     *locationManagerAccuracyLabel;


...

@property (nonatomic, retain) IBOutlet UIView *locationManagerAccuracyUIView;
@property (nonatomic, retain) IBOutlet UILabel *locationManagerAccuracyLabel;

Delegate.m

...

@synthesize locationManagerAccuracyUIView;
@synthesize locationManagerAccuracyLabel;

...

BTW: Other places in another timer i DO set the alpha to fade in and out and THAT works! So locationManagerAccuracyUIView is valid and defined as a view…

For instance:

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[locationManagerAccuracyLabel setAlpha:1];
[UIView commitAnimations];

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[self.locationManagerAccuracyUIView setAlpha:.7];
[UIView commitAnimations];

…and it DOES work. Can anyone help me?

As an aside: I know, when typing this I used self.locationManagerAccuracyUIView and locationManagerAccuracyUIView interchangeably to see if for some reason that was the issue. It is not. 🙂
Thx

  • 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-14T05:49:46+00:00Added an answer on May 14, 2026 at 5:49 am

    First: Rect is null because you are using a %@ to format it, which prints objects and it is not an object, it is a struct. If you want to print it out, convert it to a string using NSStringFromCGRect(rect) and print that instead. The only reason you’re not crashing at that point is because the x-coordinate is stored first in the struct, and is equal to zero, which is the same as the null pointer.

    Second, your origin is printing out as 0 possibly because you are using %d to format the x and y values, which prints out a signed decimal integer, but they are in fact decimal floating-point values.

    Third: The frame of the view is not returned by reference. After you change the rect, you have to reassign it to the view. That is, this:

    rect.origin.y -= 30;
    [UIView commitAnimations];
    

    should be this:

    rect.origin.y -= 30;
    self.locationManagerAccuracyUIView.frame = rect;
    [UIView commitAnimations];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I prefer creating my nav menus from markup (rather than Javascript), like in this
When creating a new nav-based iphone app, how do you add a button to
I'm creating an iPad app using Jquery Mobile, and would like to create a
Im creating a nav that uses jquery to replace the image on rollover. Here
I am creating a custom simple dropdown using jQuery that hides/shows a element based
I am creating a dropdown that slides down when hovered over. This is some
I'm programmatically creating a tab bar based app. In the application:didFinishLaunchingWithOptions (app delegate) method
Creating an a app, where I store bunch of photos in the drawable folder,
Creating liquid layouts is an immense pain. Now, I totally understand that tables should
(creating a separate question after comments on this: Javascript redeclared global variable overrides old

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.