UIHardware problems

Discussion in 'iOS Development' started by skiier239, Oct 12, 2008.

  1. skiier239

    skiier239 New Member

    Joined:
    Feb 23, 2008
    Messages:
    35
    Likes Received:
    0
    Device:
    iPhone 3GS (Black)
    Whenever I try to compile an application which includes UIHardware it comes up with an error. When I include
    Code:
    #import <UIKit/UIHardware.h>
    I am told that UIHardware.h cannot be found

    When I put
    Code:
    	rect = [ UIHardware fullScreenApplicationContentRect ];
    in an app I anm told error: 'UIHardware' undeclared (first use in this function)

    I presume that UIHardware.h is needed for the above command. I have heard from a few places that UIHardware.h is not on 2.1. Is this true?
    (By the way I am using GCC)
  2. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    UIHardware is nonexistent in firmware 2.x. If you want the full screen, use [[UIScreen mainScreen] bounds] or [[UIScreen mainScreen] applicationFrame];
  3. Chicken

    Chicken Retired Moderator

    Joined:
    Feb 17, 2008
    Messages:
    2,494
    Likes Received:
    7
    Device:
    iPhone 5S
    hey skylar hold on a minute I know you know much more about coding and the iphone than I do but I was searching through in SSH and it does actually include UIHardware.h care to explain?

    also wondering though why it dosen't include UIButton has it changed?????
  4. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    That's a 1.x header, not a 2.x header.
  5. Chicken

    Chicken Retired Moderator

    Joined:
    Feb 17, 2008
    Messages:
    2,494
    Likes Received:
    7
    Device:
    iPhone 5S
    oh yeah sorry totally forgot about them any idea where UIButton has gone I've seen NSButton is that it?:??
  6. gojohnnyboi

    gojohnnyboi Well-Known Member

    Joined:
    Jan 25, 2008
    Messages:
    3,339
    Likes Received:
    55
    Skylar, as far as i know UIHardware EXISTS in 2.1, just not in the SDK. Although it's a lot easier to just use UIScreen, those who wish to use UIHardware for some reason can do so, just by class-dumping the UIKit framework.
  7. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    Okay, it does exist, but becasue it isn't part of the SDK, Apple can replace or remove anything in it at anytime. There's nothing in it that you can't get elsewhere in the SDK, so you might as well do things the "right way" in order to avoid problems in the future.

    Code:
    #import <Foundation/NSObject.h>
    
    @interface UIHardware : NSObject
    {
    }
    
    + (float)statusBarHeight;
    + (void)_setStatusBarHeight:(float)fp8;
    + (struct CGSize)mainScreenSize;
    + (struct CGRect)fullScreenApplicationContentRect;
    + (struct CGRect)fullScreenApplicationContentRectForDeviceOrientation:(int)fp8;
    + (struct CGRect)fullScreenApplicationContentRectForCurrentDeviceOrientation;
    + (int)ringerState;
    + (int)deviceOrientation:(BOOL)fp8;
    + (BOOL)setSpeakerPhoneEnabled:(BOOL)fp8;
    + (BOOL)isTTYEnabled;
    + (struct CGSize)TVScreenSize;
    + (float)TVHorizontalPixelScale;
    + (BOOL)_TVOutStatus:(BOOL)fp8;
    + (BOOL)TVOutCapableAndPreferred;
    + (BOOL)TVOutCapable;
    + (void)TVOutResetPreferred;
    + (void)alertSheet:(id)fp8 buttonClicked:(int)fp12;
    + (void)accessoryAvailabilityChanged;
    + (id)deviceName;
    + (id)localizedDeviceName;
    
  8. gojohnnyboi

    gojohnnyboi Well-Known Member

    Joined:
    Jan 25, 2008
    Messages:
    3,339
    Likes Received:
    55
    yup, and looking at these things, it kind of looks to me as if maybe UIScreen and UIDevice use a couple of things from UIHardware(although apple will never let you know!)

Share This Page