Mac Cocoa |
Author |
Message |
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3136 Location: Europe
|
Posted: Mon May 11, 2009 3:42 pm Post subject: Modality & Alerts |
|
|
Under The Bridge - full screen presentModalViewController
"Today we have a little iPhone user interface programming problem to
present to you with its not so self evident solution, courtesy of the kind
assistance of one Bryan Henry on the iphonesdk list." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3136 Location: Europe
|
Posted: Mon May 11, 2009 3:44 pm Post subject: |
|
|
Bill Dudney: Presenting Modal Views Bug
"When you present a modal view controller via the -presentModalViewCont-
roller:animated: method the viewWillAppear: method gets called on the mo-
dal view controller before the view is actually loaded." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Tue May 12, 2009 10:05 am Post subject: |
|
|
SO - Is parentViewController always a Navigation controller?
"The update to page 1 wasn't happening, and it took me a long time to
realize that the "doSomethingPleaseWithSomeData" message was not be-
ing sent to Page1ViewController, but the Navigation Controller."
ADC - parentViewController somewhat misleading:
"The underlying view controller if this view controller is a modal view cont-
roller; otherwise, the enclosing navigation or tab bar controller." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed May 20, 2009 2:09 am Post subject: |
|
|
Modal UIViewController title not showing
"I have a UIViewController object which is being presented as a modal view,
but I am unable to set the view title. I want the title to vary depending on
the context." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Jul 08, 2009 12:33 am Post subject: |
|
|
iphonedevsdk.com - Webservice load wait
"So here how I code this
1) I'm loading and displaying UINavigationController with a root view con-
troller
2) Asking a web service for data and loading UIView with activity indicator
as a root view controller's view
3) Once the data from web service is ready I animate the opacity of the
root controller's view to 0.0 and then I'm replacing it with the UITableVi-
ew ..." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Mon Sep 14, 2009 12:15 am Post subject: |
|
|
mf - dismissModalView
"I have a bunch a views connected through buttons by using the command
presentModalView." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Sun Sep 27, 2009 2:19 am Post subject: |
|
|
MF - Modal UIViewController that doesnt cover all screen
"With the normal invocation, the modal's view is resized to be as high as
the screen (460px) and slides all the way to the top. i tried forcing the size
and the y origin back to what i need in viewDidLoad and viewWillAppear:
with no effect." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Mon Mar 08, 2010 1:59 am Post subject: |
|
|
Jeff LaMarche - Implementing a Wait "Alert"…
"Now, you should be very careful about using something like this. You
really don't want to annoy your users, so you should only do this when
it's absolutely necessary and only show it for short periods of time." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Mon May 17, 2010 11:01 pm Post subject: |
|
|
Jeff LaMarche - Custom Alert Views
"What you can do, however, is create your own class that simulates the be-
havior of UIAlertView. You can find a sample implementation of the techni-
que discussed in this post by downloading this project. In this simple exam-
ple, we're going to create an alert view that lets the user enter a value into
a single text field."
Next day: Some Good Advice
"Joe posted some code to replace the gradient background in the previous
post. Admonished for my laziness and inspired to make the code better, I
incorporated his suggestion." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Fri Jul 16, 2010 12:30 am Post subject: |
|
|
so - UIActionSheet cancel button strange behaviour
"If you call UIActionSheet's [sheet showInView:self.view] from a view con-
troller that is a child of a UITabViewController, then the hit testing on the
cancel button fails in that portion of the UIActionSheet that lies above the
tabbar's view." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Fri Jul 16, 2010 12:41 am Post subject: |
|
|
meekismurder.com - UIActionSheet Cancel Button Blocked In TabBar App
"Instead of showing the ActionSheet in self.view like normal, show it in
the App Delegate Window instead, ensuring it’s on top of everything,
here’s how:
Code: | UIActionSheet *confirmSheet = [[UIActionSheet alloc] initWithTitle:@”Do Something?”
delegate:self
cancelButtonTitle:@”Cancel”
destructiveButtonTitle:@”Confirm”
otherButtonTitles:nil];
[confirmSheet showInView:appDelegate.window];
[confirmSheet release]; |
|
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Tue Aug 31, 2010 2:46 pm Post subject: |
|
|
MF - Where in Cocoa can I find an infinite loop??
"Maybe use a CFRunLoopObserver. Google it. Read its reference docs.
Then look up CFRunLoop and NSRunLoop's getCFRunLoop method." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Thu Oct 21, 2010 11:02 pm Post subject: |
|
|
bitesizecocoa.com - How to get an alert view background in your
iPhone app
"Sometimes you may want to mimic the look of a UIAlertView without
showing the actual alert itself. For example, you may have a HUD style
modal alert. The UIAlertView background is a vignette style overlay that
sits in between the current view and the alert dialog itself." |
|
Back to top |
|
|
XNote Kapetan
Joined: 16 Jun 2006 Posts: 532
|
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Fri Nov 05, 2010 1:46 am Post subject: |
|
|
UIAlertViewDelegate Protocol Reference
- (void)alertViewCancel:(UIAlertView *)alertView;
// Called when we cancel a view (eg. the user clicks the Home button). This
// is not called when the user clicks the cancel button.
// If not defined in the delegate, we simulate a click in the cancel button |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Sat Jan 21, 2012 7:20 pm Post subject: |
|
|
blog.codecropper.com - Replicating TweetBot’s Alerts and Action Sheets
"Since the first time I had to use an UIActionSheet or UIAlertView in an app
I disliked the way it was implemented. It was a pain if you had two kinds of
alerts in the same class for example as everything is done by invoking a
delegate method. I also disliked the fact that the code that should be exe-
cuted in the event of a button was almost always in a separate place in your
source code. The code needs a lot of constants, switches and you need to
tag your UIAlertView…. I hated it!" |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3136 Location: Europe
|
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Sat Jun 02, 2012 2:04 pm Post subject: |
|
|
Ajnaware’s Weblog - Dynamically adding UIActionSheet buttons
"The problem with this becomes apparent when you run it – the cancel button
appears at the TOP of the sheet, whereas standard practice seems to be that
it should be at the bottom. How to achieve this?" |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3136 Location: Europe
|
Posted: Sat Apr 13, 2013 10:29 pm Post subject: |
|
|
so - How to create colored or translucent background for UIActionSheet?
"When you try deleting a note in iPhone's Notes application, an UIActionSheet
pops up. The sheet is translucent (but not black translucent). How is that
achieved? Is it possible to make the background of UIActionSheet a certain
color?" |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Oct 12, 2016 8:07 pm Post subject: |
|
|
rw - UIPresentationController Tutorial: Getting Started
"In this UIPresentationController tutorial you'll learn how to present view
controllers with custom transitions and custom presentation styles. No longer
will you be limited to full-screen or popover presentations and the standard
transition animations. You'll start with some drab, lifeless view controller
presentations and you'll bring them to life." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Oct 12, 2016 8:12 pm Post subject: |
|
|
appcoda - A Beginner's Guide to Presentation Controllers in iOS 8
"We'll subclass UIPresentationController (which was introduced in iOS 8) to
provide view and transition management for presented view controllers.
Presentations usually consist of three major parts: the presented view con-
troller, presenting view controller and the chrome. Looking at a typical pre-
sentation below, you can see these views. For apps shipped by Apple, the
chrome is usually a grey semi-transparent view, but you have the freedom
to style it however you want." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Oct 12, 2016 8:17 pm Post subject: |
|
|
pspdfkit - Presentation Controllers and Adaptive Presentations
"PSPDFKit is written in Objective-C so all the code samples in this article are
too, although our problems are with UIKit and are equally applicable when
using Swift. You can read more about the problems discussed here and find
sample projects by following the Radar links." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Oct 12, 2016 8:32 pm Post subject: |
|
|
github.com - FPPopover
"This library provides an alternative to the native iOS UIPopoverController,
adding support for iPhone and additional opportunities to customize the look
and feel of the popovers.
The development started as first as a Mobiloud open source component, after
some commits we realized was a appreciated library so I decided to continue
the development, also the development is continuing thank to your feedbacks
and pull requests!" |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Nov 09, 2016 10:42 pm Post subject: |
|
|
so - Change Action sheet popover arrow in iOS8
"use below line for remove arrow from action sheet"
"The selected answer does not center the alert if you have a nav/status bar.
To exactly center your alert controller..." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Nov 29, 2017 11:51 am Post subject: |
|
|
so - UIActionSheet deprecated on iOS8
Code: | UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:@"Action Sheet" message:@"alert controller" preferredStyle:UIAlertControllerStyleActionSheet];
[actionSheet addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
// Cancel button tappped.
[self dismissViewControllerAnimated:YES completion:^{
}];
}]];
[actionSheet addAction:[UIAlertAction actionWithTitle:@"Delete" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
// Distructive button tapped.
[self dismissViewControllerAnimated:YES completion:^{
}];
}]];
[actionSheet addAction:[UIAlertAction actionWithTitle:@"Other" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
// OK button tapped.
[self dismissViewControllerAnimated:YES completion:^{
}];
}]];
// Present action sheet.
[self presentViewController:actionSheet animated:YES completion:nil]; |
|
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Thu Nov 30, 2017 1:07 pm Post subject: |
|
|
so - UITextField in UIAlertController (border, backgroundColor)
"I figured this out by walking the view hierarchy in the debugger, from which I
noticed a UIVisualEffectView. Removing that seems to give you what you want
along with setting the containing view to a clear background. Without removing
the visual effect, a clear background shows what is behind the alert view itself
for some reason."
Code: | UIAlertController *alertController =
[UIAlertController alertControllerWithTitle:@"Its Not Pretty!"
message:@"Some times things get ugly!"
preferredStyle:UIAlertControllerStyleAlert];
[alertController addTextFieldWithConfigurationHandler:^(UITextField *textField){
textField.text = @"Text: No border and clear 8^)";
}];
[self presentViewController:alertController animated:TRUE completion:^{
}];
for (UIView* textfield in alertController.textfields) {
UIView *container = textField.superview;
UIView *effectView = container.superview.subviews[0];
if (effectView && [effectView class] == [UIVisualEffectView class]){
container.backgroundColor = [UIColor clearColor];
[effectView removeFromSuperview];
}
} |
|
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Fri Dec 15, 2017 8:11 pm Post subject: |
|
|
so - How to present UIAlertController when not in a view controller
Code: | UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Title" message:@"message" preferredStyle:UIAlertControllerStyleAlert];
//...
id rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
if([rootViewController isKindOfClass:[UINavigationController class]])
{
rootViewController = ((UINavigationController *)rootViewController).viewControllers.firstObject;
}
if([rootViewController isKindOfClass:[UITabBarController class]])
{
rootViewController = ((UITabBarController *)rootViewController).selectedViewController;
}
[rootViewController presentViewController:alertController animated:YES completion:nil];
|
|
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3136 Location: Europe
|
Posted: Wed Dec 19, 2018 5:38 am Post subject: |
|
|
https://pspdfkit.com/blog/2016/popovers-on-popovers/
Preventing Popovers on Popovers
Show one popover at a time. Displaying multiple popovers clutters the interface and causes confusion. Never show a cascade or hierarchy of popovers, in which one emerges from another. If you need to show a new popover, close the open one first. |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Tue Sep 03, 2019 11:41 am Post subject: |
|
|
sarun - Modality changes in iOS13
"One behavior that changed and might break your old app once you starting
adopting new iOS 13 is the modal presentation. So with iOS 13, default
presentation for modal is now in sheet style." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3136 Location: Europe
|
|
Back to top |
|
|
|