I Created a monotouch project, add add new files: images/abcd.png(build action:content) into my project. when open the mainUI.xib, In xcode(4.2) Interface Builder design-time, I manually set the image property with the value "images/abcd.png", but it won't show up until run time.
I know this is a known limitation of MonoDevelop and Interface Builder, but I want to use the image as a background pic to layout my UI in design-time , how can I do?
Environment: XCode4.2+MontoDevelop2.8.6.4+Montotouch 5.2
in MonoDevelop go project options -> iPhone Application -> Advanced
add image to Icon files section.
select image in design time, then you will see image at run time.
Related
I have the following Image asset defined (FSDirectButton)...
How do I specify a button to use this as it's image in the Xamarin xib designer?
When I choose the Image option in the properties window all I see are images that are stored in my Images folder.
I inherited this app which was originally done in a older version of Xamarin iOS, so not sure if that is affecting things or not...
However I want to use the image asset library for my buttons, but I am not sure how to specify in the designer which image to use? Or do I have to do it runtime in code?
Look at this video. It can help you, but raise some new bug. Enjoy
Also you can set the Image from Asset catalog in your ViewDidLoad() method.
For example:
//get image set from asset catalog
var imageFromBunde = UIImage.FromBundle("ImageSet"); //ImageSet - name of your image set in Asset catalog
myImage.Image = imageFromBundle;
I'm trying to create a Windows 8.1 store app, and I need to add a button to it.
The button should display an image.
I add the image to the assembly in Solution Exploreras Artwork/Pencil.png
I add the button to the UI
Using the property editor for the button, I select Foreground image.
The designer shows a list of available images from the assembly, I choose the image.
The designer shows the selected image (partially).
The button remains blank.
I tryied playing around with different content types (of the image), as Content, Embedded resource, Do not copy, Copy if newer.
The image is not visible either at design or run time.
I found tons of articles from 2005 to 2012 about this problem in WPF. Tryed to change the image source (although I think the designer should set it correctly):
Pencil.png
Artwork/Pencil.png
pack://siteoforigin:,,,/Pencil.png
pack://siteoforigin:,,,/Artwork/Pencil.png
pack://application:,,,/Pencil.png
pack://application:,,,/Artwork/Pencil.png
Any ideas?
To make the environment clear:
Visual Studio 2013 Update 2
Project type: Visual C#/Store Apps/Windows Apps/Blank App
Target: Windows 8.1
It seems that the correct combination (to display an image on a Windows 8 app button) is:
set it as backbround image (as opposed to foreground)
set the file to be "PRIResource" (as opposed to "Embedded resource")
use the designer to specify the image (which will generate a reference like this "Artwork/Pencil.png")
:-(
It works design-time, but it does not work runtime.
Here's one that works both design-time and runtime:
set it as backbround image (as opposed to foreground)
set the file to be "Content", "Copy if newer"
use the designer to specify the image (which will generate a reference like this "Artwork/Pencil.png")
My app icon is just a grey super ellipse even though I have specified a icon asset catalog in my Targets App Icons and Launch Images.
The following worked for me creating a Share Extension, but I believe Action Extension will do the same. Note that in the case of an Action extension, you need a monochromatic version.
If you are using an asset catalog for your main application icon, you should be able to get the Extension to leverage that same asset catalog. The key for me was to:
Select my extension and tell it to use Asset Catalog. Select the same catalog your main icon is using. The default should be AppIcon
Select the image.xcassets file in XCode Project Navigator
Check my extension so that it is included in the Target Membership
Your asset catalog in your main application isn't accessible from your application extension as they are two separate applications bundles that can only share Frameworks.
You will need to create a separate asset catalog in your action extensions folder and reference that one in your Targets.
EDIT: This worked for me for iphone but not for ipad simulator. Making new images (60x60 and 76x76) with only black and white solved it.
Add the image.xcassets to the extension target
While developing a project for Windows Phone 7, I'm adding an image control onto the Grid and using the following code in C# to set the image source:-
Uri nUri = new Uri("/TestImage.png", UriKind.Relative);
BitmapImage nBitmapImage = new BitmapImage(nUri);
FacebookImage.Source = nBitmapImage;
The problem is that whenever I use custom images, they do not show up when I build and run the app on the emulator. Whereas, if I change the image file name in the above code to one of the images that are included in the project by default (ApplicationIcon.png), the image shows up upon running. I would like to know if this is a problem with the code or with the custom image files I'm using. I'm ensuring that the images I'm creating are proper and have the same attributes as the images included by default.
Could someone please help me out with this.
Thanks.
Click on your custom picture in Visual Studio's Solution Explorer. Then, look at the property window (press F4 if it's closed), and at the "Build Action" line. It basically tells the compiler how to embed your file in the application. The build action of ApplicationIcon.png should be "Content", just set the same one for your custom pictures.
Stanford put out for free a series of videos and handouts for their iPhone programming course. I've played around with the first assignment, but all I get on the Simulator is a blank screen. Here's the recipe I followed; what am I missing?
In Xcode, create a new Window-Based iPhone application.
Open the project’s MainWindow.xib file with Interface Builder.
Add the following user interface elements to the view:
a text label
an image view
Set the following properties on the text label:
text value should be “Hello Stanford!” (or something suitably amusing)
text alignment should be centered
adjust the size to make the text large
Back in Xcode, add an image (.png or .jpg) to your project. You can use the Project > Add to Project... menu to select an image. Note: Be sure to check the “Copy items into desti- nation group’s folder (if needed)” checkbox.
Once your image is in the project, return to MainWindow.xib, select the image view and set the image for the image view that you dragged in previously using the Attributes Inspector.
Configure the image view’s “Mode” to be “Aspect Fit”
In Xcode, build and run your project in the simulator.
Been there, done that, but no t-shirt. Seems to me I'm missing connecting lines in the Interface Builder, but I see nothing in the recipe about that.
Since you didn't provide a link, I'll assume you're talking about this document.
Works for me on XCode 3.2.3/Snow Leopard 10.6.4. I created the project as iPhone-only, as opposed to Universal, but it shouldn't make a difference for your purposes.
Try again from scratch, or take a look at my project here.