I am changing tabar to work in ios7 I am having one image for selected as well as unselected tabbarItem image.And as SetFinishedImages() has deprecated in ios7.So how should I apply one image for selected as well as unselected tabaritem.Which method should I use in xamarin for this.And how to differentiate that tabbaritem is selected/unselected as I am using one image.
You should use Appearance:
UITabBar.Appearance.BackgroundImage = UIImage...
UITabBar.Appearance.SelectoinIndicatorImage = UIImage...
Related
I'm following the instructions for adding stylekit images to storyboards by adding an object, setting it's class to stylekit and then right click dragging to the UIImage from the stylekit object - however I'm not seeing the images show up in UIImageView preview in the storyboard. The image is there when I run the code however.
Is there a different series of steps I need to take? I'm using ios9 xcode 7.
Interface Builder doesn’t allow previewing this kind of connections. To see the image in IB, you will need to subclass the view, mark it as #IBDesignable and override drawRect method, where you call the StyleKit drawing method.
i am making a java desktop application using javafx. For gui building i am using scene builder 2.0.
Everything is just perfect as expected just 1 thing. I want to customize the buttons. i want to assign a custom graphic to a button.
When i use [button.setgraphic(node)] , this statement set the new graphic to the button but default graphic of button also remains present as well.
I just want to remove the default graphic and then want to assign the new (custom) garaphic to a control like buttons and radio buttons in javafx. 1 thing again i must tell that i am using scene builder for building gui.
How can i achieve this ?
thanks in advance....
Below is the screen-shot of current occuring situation, .....
Here i have made a button using javafx scene builder , and then in the controller of the fxml file (.java file) i am trying to set the image (shown in orange box in snapshot) to that button by using setGraphics property of button ..... i just need that button to be of following shape ...
You'd better customize your button via CSS. Here goes tutorial. What you are trying to do is to modify button picture (which is empty by default). I guess this wasn't your exact purpose.
button.setGraphic(null)
// worked for me.
I have a list on LWUIT form. I want to add background image to this form. I try using the following piece of code. The image is being set in background but the list distorts while scrolling.
categoryList=new List(categories.categoryVector);
categoryList.setListCellRenderer(new CategoryListCellRenderer());
Image img=parentMIDlet.constants.getBgImage();
//img=img.scaled(this.getPreferredW(), this.getPreferredH());
getStyle().setBackgroundType(Style.BACKGROUND_IMAGE_ALIGNED);
getStyle().setBackgroundAlignment(Style.BACKGROUND_IMAGE_ALIGN_CENTER);
getStyle().setBgImage(img);
//getStyle().setBgPainter(new ImagePainter(img));
addComponent(BorderLayout.CENTER,categoryList);
categoryList.isScrollableY();
categoryList.setFixedSelection(List.FIXED_NONE);
categoryList.addActionListener(new CategoryListActionListener(mainMIDlet,categoryList));
If you are using 1.5 or newer you should use:
getStyle().setBackgroundType(Style.BACKGROUND_IMAGE_ALIGNED_CENTER);
Make sure the list bg transparency is set to 0 for both selected and unselected styles. Make sure the parent form is set to scrollable false.
I have a problem,
I am programming with Monotouch 5.2.8 for IOS 5.1.
But since the IOS 5.1 update my iPad configs the UISplitViewController so it is docked on the
left side instead of presented as a popover.
It works with IOS 5.0 but in 5.1 i got this problem.
Here is the source code for my UISplitViewController:
splitViewController = new UISplitViewController ();
splitViewController.WeakDelegate = detailViewController;
splitViewController.ViewControllers = new UIViewController[] {
navigationController,
detailViewController
};
From Apple's iOS 5.1 SDK release notes:
In 5.1 the UISplitViewController class adopts the sliding presentation
style when presenting the left view (previously only seen in Mail).
This style is used when presentation is initiated either by the
existing bar button item provided by the delegate methods or by a
swipe gesture within the right view. No additional API adoption is
required to obtain this behavior, and all existing API, including that
of the UIPopoverController instance provided by the delegate, will
continue to work as before. If the gesture cannot be supported in your
app, set the presentsWithGesture property of your split view
controller to NO to disable the gesture. However, disabling the
gesture is discouraged because its use preserves a consistent user
experience across all applications.
Here (login required).
UPDATE:
From what I understand on the above, we can kiss the automatic popover appearance of the master controller goodbye in iOS 5.1.
The only way I see is possible to keep the "old" appearance, is by implementing our own UIPopoverController and taking advantage of the ShouldHideViewController delegate method. Thankfully with MonoTouch, we have that method available as a property in the UISplitViewController class, making things a bit simpler.
I do get a strange behavior though. With iOS SDK 5.1 on my Mac and iOS 5.1 on my iPad; on the device, I get the "sliding" appearance, while on the simulator I get the "old", popover appearance. This is with MonoTouch 5.2.4, which is the latest stable version. Also, it does not contain a PresentsWithGesture property. I tried setting its value to false through MonoTouch.ObjCRuntime messaging, but no luck. The selector keeps returning true. So I cannot deactivate the swipe gesture.
Even tried creating my own UIPopoverController and assigning it as the master in the split controller to see what happens. Doesn't work because UIPopoverController is not a UIViewController...
Some useful info in this question, for ObjC.
Turns out you can disable the presentsWithGesture in the application delegate, but once the view controllers have been presented, there is no changing it.
I needed to disable the appearance of the left view controller during a login process, but turns out I can't enable it later.
I'm writing my first LWUIT and Java ME application and trying to get button states to work. I know I can do it in the resource editor, but I'd really like to know why my code isn't working. The code I have below behaves seemingly erratically. If I select the first button, it works fine. When I select the second button, that button has the foreground of the selected stated, but the background of the unselected state. The same goes for the third button. However, when I wrap back around to the first button, both the first button and the third button have the background of the selected state, the first button has the foreground of the selected state and the third button has the foreground of the unselected state.
I've tried reading tutorials and online forums, but it seems that most of those are horribly out of date. Even the tutorial on the official LWUIT page has commands in it that are so deprecated that Netbeans shows them as unresolved instead of deprecated. I'm sure it's a simple mistake, but I just can't see from this code how the other buttons should be affected by one getting selected or unselected, or why the style for selected and unselected gets changed every time a buttons state changes.
Style buttonUp = new Style();
buttonUp.setAlignment(Component.CENTER);
buttonUp.setBgColor(0x0082ff);
buttonUp.setFgColor(0xffffff);
buttonUp.setMargin(5,5,0,0);
Style buttonDown = new Style();
buttonDown.setAlignment(Component.CENTER);
buttonDown.setBgColor(0xd7d7ee);
buttonDown.setFgColor(0x000000);
buttonDown.setMargin(5,5,0,0);
Container buttons = new Container(new BoxLayout(BoxLayout.Y_AXIS));
Button firstButton = new Button("first");
firstButton.setUnselectedStyle(buttonUp);
firstButton.setSelectedStyle(buttonDown);
firstButton.setPressedStyle(buttonDown);
Button secondButton = new Button("second");
secondButton.setUnselectedStyle(buttonUp);
secondButton.setSelectedStyle(buttonDown);
secondButton.setPressedStyle(buttonDown);
Button thirdButton = new Button("third");
thirdButton.setUnselectedStyle(buttonUp);
thirdButton.setSelectedStyle(buttonDown);
thirdButton.setPressedStyle(buttonDown);
This should be all of the relevant code as it is the only part that deals with the buttons, other than the addComponent calls that adds the buttons to the container and the container to the form.
You are reusing style object instances which isn't legal each component state must have a singular instance. It is more common in LWUIT to do this by:
button.getUnselectedStyle().setFgColor(...);
Alternatively you can implement the logic in a method:
updateButtonTheme(Style);
and invoke it as:
updateButtonTheme(button.getUnselectedStyle());