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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:21:03+00:00 2026-05-26T21:21:03+00:00

I’m preparing to submit such a customization by subclassing UIAlerView. It’s layout is entirely

  • 0

I’m preparing to submit such a customization by subclassing UIAlerView. It’s layout is entirely based on the given topography of the UIAlertView, have no read any private property. Is this kind of customization acceptable by App Store review process?

enter image description here

BGAlertViewWithSwitch.h

//
//  BGAlertViewWithSwitch.h
//  BGAlertViewWithSwitch
//
//  Created by Borbas Geri on 11/7/11.
//  Copyright 2011 ©ompactApps. All rights reserved.
//

#import <Foundation/Foundation.h>


//An assumed value.
#define ALERT_VIEW_LINE_HEIGHT 20.0
#define ALERT_VIEW_LABEL_PADDING 5.0
#define ALERT_VIEW_LABEL_ALPHA 0.5

#define kAlertSwitchLabelTag 42


@interface BGAlertViewWithSwitch : UIAlertView 
{
    UISwitch *_alertSwitch;
    UILabel *_alertSwitchLabel;
}
@property (nonatomic, retain) UISwitch *alertSwitch;
@property (nonatomic, retain) UILabel *alertSwitchLabel;
@property (nonatomic, readonly, getter=isOn) BOOL on;

-(id)initWithTitle:(NSString*) title
           message:(NSString*) message
     switchMessage:(NSString*) switchMessage
          delegate:(id) delegate
 cancelButtonTitle:(NSString*) cancelButtonTitle
     okButtonTitle:(NSString*) okButtonTitle;

@end

BGAlertViewWithSwitch.m

//
//  BGAlertViewWithSwitch.m
//  BGAlertViewWithSwitch
//
//  Created by Borbas Geri on 11/7/11.
//  Copyright 2011 ©ompactApps. All rights reserved.
//


#import "BGAlertViewWithSwitch.h"


@implementation BGAlertViewWithSwitch
@synthesize alertSwitch = _alertSwitch;
@synthesize alertSwitchLabel = _alertSwitchLabel;


#pragma mark - UISwitch Accessor

-(BOOL)isOn
{
    return self.alertSwitch.isOn;
}


#pragma mark - View lifecycle

-(id)initWithTitle:(NSString*) title
           message:(NSString*) message
     switchMessage:(NSString*) switchMessage
          delegate:(id) delegate
 cancelButtonTitle:(NSString*) cancelButtonTitle
     okButtonTitle:(NSString*) okButtonTitle
{

    //For testing layout
    NSString *placeHolder = @"";

    //Append a line to the message that leaves the place for the switch. 
    NSString *_expandedMessage = [NSString stringWithFormat:@"%@\n%@\n%@\n", message, placeHolder, placeHolder];

    if (self = [self initWithTitle:title
                           message:_expandedMessage
                          delegate:delegate
                 cancelButtonTitle:cancelButtonTitle
                 otherButtonTitles:okButtonTitle, nil])
    {
        //Add switch.
        self.alertSwitch = [[UISwitch alloc] init];
        self.alertSwitch.on = YES; 
        [self addSubview:self.alertSwitch];

        //Add label.
        self.alertSwitchLabel = [[UILabel alloc] init];
        self.alertSwitchLabel.text = switchMessage;
        self.alertSwitchLabel.tag = kAlertSwitchLabelTag;
        [self addSubview:self.alertSwitchLabel];
    }
    return self;
}

- (void)dealloc
{
    self.alertSwitch = nil;
    self.alertSwitchLabel = nil;

    [super dealloc];
}


#pragma mark - Topography

- (void)layoutSubviews
{
    NSLog(@"layoutSubviews to (%@)", NSStringFromCGRect(self.frame));

    //Weak link to the message label.
    UILabel *messageLabel;

    //Enumerate subviews to find message label (the base of the topography).
    for (UIView *eachSubview in self.subviews)
        if ([[eachSubview class] isEqual:[UILabel class]])
        {
            UILabel *eachLabel = (UILabel*)eachSubview;
            if (eachLabel.tag != kAlertSwitchLabelTag)
            {
                messageLabel = eachLabel;
                NSLog(@"Each label frame (%@), saying '%@'", NSStringFromCGRect(eachLabel.frame), eachLabel.text);                
            }
        }

    //Center new content.
    CGSize alertSwitchLabelSize = [self.alertSwitchLabel.text sizeWithFont:messageLabel.font];
    float horizontalCentering = (messageLabel.frame.size.width - (alertSwitchLabelSize.width + ALERT_VIEW_LABEL_PADDING + self.alertSwitch.frame.size.width)) / 2;


    //Switch goes to the bottom right.
    float switchVerticalCentering = ((ALERT_VIEW_LINE_HEIGHT * 2 + 1) - self.alertSwitch.frame.size.height ) / 2;
    CGRect alertSwitchFrame = CGRectMake(messageLabel.frame.origin.x + messageLabel.frame.size.width - self.alertSwitch.frame.size.width - horizontalCentering,
                                         messageLabel.frame.origin.y + messageLabel.frame.size.height - self.alertSwitch.frame.size.height - switchVerticalCentering,
                                         self.alertSwitch.frame.size.width,
                                         self.alertSwitch.frame.size.height);
    self.alertSwitch.frame = alertSwitchFrame;

    //Label goes to the bottom left.    
    float switchLabelVerticalCentering = ((ALERT_VIEW_LINE_HEIGHT * 2 + 1) - ALERT_VIEW_LINE_HEIGHT ) / 2;
    CGRect alertSwitchLabelFrame = CGRectMake(round( messageLabel.frame.origin.x + horizontalCentering ),
                                              round( messageLabel.frame.origin.y + messageLabel.frame.size.height - ALERT_VIEW_LINE_HEIGHT - switchLabelVerticalCentering ),
                                              messageLabel.frame.size.width - self.alertSwitch.frame.size.width,
                                              ALERT_VIEW_LINE_HEIGHT); //self.alertSwitchLabel.frame.size.height);
    self.alertSwitchLabel.frame = alertSwitchLabelFrame;

    //Copy message label properties.
    self.alertSwitchLabel.backgroundColor = [UIColor clearColor];   
    self.alertSwitchLabel.textColor = messageLabel.textColor;
    self.alertSwitchLabel.font = messageLabel.font;
    self.alertSwitchLabel.shadowColor = messageLabel.shadowColor;
    self.alertSwitchLabel.shadowOffset = messageLabel.shadowOffset;

    //Weaken.
    self.alertSwitchLabel.alpha = ALERT_VIEW_LABEL_ALPHA;

    [super layoutSubviews];
}


@end
  • 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-26T21:21:03+00:00Added an answer on May 26, 2026 at 9:21 pm

    No one but Apple can adequately answer this question, so the best thing is to put it to the test. I think the main question you have to ask yourself is: Have I violated any provisions in the Apple Developer Agreement? If not, then submit your app. If you are worried about rejection, think of another way in which this could be done, as a backup, and be prepared to submit that in case of a problem.

    Not that you have asked, but I would also opine that this change to Apple’s design is not very intuitive. Do you mean the switch to mean “also delete from moquus?” as you already have a big delete button there. If the switch is off, then what does the delete button delete?

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
I have a text area in my form which accepts all possible characters from

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.