How to show UIAlertView without dimming the background in objective C? - objective-c

Dimming the background upon showing an UIAlertView seems the default behavior of iOS. Can I disable this effect so that the background will not be dimmed, because I have a rather dark background already. Thanks!

UIAlertView doesn’t provide a way to do that. If you need that behavior, you’ll have to find a third-party alert view that does or create your own custom one.

You can't do that with the built-in UIAlertView class from Apple. Try checking out this custom alert view class, although you will need to further customize it to remove the background on the pop-up. Other than that, you could make a custom class from scratch.

Related

UIAlert - change message font size IOS7

I have a working UIalert view with text field and 2 buttons.
I want the text in the message to be a bit bigger, how can I do it?
thanks,
Shlomi
The UIAlertView cannot be changed. If you wish to modify it, you will need to create your own from scratch.
Please see the UIAlertView Class Reference, and under subclassing notes:
The UIAlertView class is intended to be used as-is and does not
support subclassing. The view hierarchy for this class is private and
must not be modified.

Alternative to UIALertView for user input ios7

Ok, we assume that now we can't add subviews in AlertViews since ios7. But when we need to popup a new little view for the user to input some data, what we have to do ? What apple says we have to do now ?
You can create your own custom alert.
I explain here a way how to do that.

Efficient way to customize UIButtons

What is the best way to customize the look of UIButtons in an app? I am working on an app where we programatically update UIButtons to look the way we want. Most of the buttons are created in Interface Builder and we want to execute our customizeButton-method on them in an efficient way. I only see two ways of achieving this:
Create the buttons in IB, assign them to an outlet and in code call customizeButton for each button.
Problem: way too much hazzle
Subclass UIButton, in the constructor initWithCoder: call customizeButton. Then use this class for buttons in IB.
Problem: allthough this works for buttons created in IB and requires less boilerplate code than point 1, I have read all the warnings against subclassing UIButton because of their class cluster.
Clearly there must be some better way, what is point 3?
Have a look at UIAppearance. It is available since iOS 5 and is especially for customizing the standard UI elements.
For ever class that is customizable is a class method called +appearance: and you can use it like this.
[[UIButton appearance] setBackgroundColor:[UIColor redColor]];
Every button will have now a red background color.
To get started have a look at Ray Wenderlichs Tutorial User Interface Customization in iOS 5 and/or session 114 - Customizing the Appearance of UIKit Controls of the WWDC11 videos.

how can I have a totally transparent UIAlertView?

I need a UIALertView, which on popping up should be transparent enough to show the background behind the alertview in a faded way and the blue color of the alert view should not appear since the background behind the alert view is black and grey in color. Changing color and putting an image to the alert view is one thing which can be seen in the links : iOS 5 black transparent UIAlertView and Changing the background color of a UIAlertView?
but I need a transparent UIAlertView. Is it possible to get one?If yes how?
Thanks for the help in advance.
If you look at Apple's documentation page for UIAlertView you'll see this note:
The UIAlertView class is intended to be used as-is and does not
support subclassing. The view hierarchy for this class is private and
must not be modified.
In other words, Apple doesn't want developers to muck around with colors or fonts or backgrounds when it comes to UIAlertView. If Apple changes the internal guts of UIAlertView in a later iOS, your app is likely to have unexpected and not-desired effects when that modified alert appears.
If you want custom UIAlertView like behavior, why not just write your own UIView that looks and behaves a lot like UIAlertView. And then you have full control over everything about how it's drawn.
As Michael said, you can't with an UIAlertView, you have to build it yourself.
You can try BlockAlertsAnd-ActionSheets, it is like a customizable UIAlerView
https://github.com/gpambrozio/BlockAlertsAnd-ActionSheets
I know it's too late but,
I'll leave this command for other developers.
.h
#interface CustomAlertView:UIAlertView {}
.m
// override
- (void)drawRect:(CGRect)rect
{
for(UIView * sub in self.subviews)
{
[sub removeFromSuperview];
}
// this removeFromSuperview will clear all thing such as background view and buttons
// do something
}

NSWindow with custom shadow

I want to draw a custom shadow on an NSWindow-Object.
Is there a way to do this by passing an own NSShadow-Object to NSWindow? Or a (private) method, where I can put my own drawing code?
Thanks,
Don't. You shouldn't alter the look of the window. Changing the look of UI is only allowed for Apple. Normal apps should use the standard one.
That said, there's a way, if you really insist on doing that. You can't just attach an NSShadow, unfortunately. Also, as far as I understand, there's no private method which draw the shadow. That's done by the Window Server, not by the app.
But you can ask the window server not to add the shadow. Have you noticed that in the Interface Builder, there's an option suppressing the shadow of a given window? That corresponds to the property hasShadow of an NSWindow.
After suppressing the shadow, you just need to draw everything by yourself. A nice sample code that does the custom window drawing is available at ADC, so have a look at it.