Add image or icon set to asset catalog to be used with NSToolbarItem - objective-c

I have a set of pixel perfect icons which I want to use on toolbar (NSToolbar) of my app. Toolbar is configurable thus I need to provide icons in four sizes: small, standard, small#2x, standard#2x.
I could not find any official information about the size of those icons, but unofficial information (confirmed by my tests) is the following:
small is 24px, normal is 32px.
Thus I need to add four different images: 24x24px, 32x32px, 48x48px, 64x64px to my image set.
As for now I could not find a correct way for that.
I have tried a dozen of different methods but could not find one which preserves pixel perfect quality of all four images.
I believe, I can load right size of the image manually each time it has to be changed, but I am wondering if where is a correct way for that.
Does anyone has a good solution for that?
And yes, I clean build folder before each test.

See the Apple Developer site Human Interface guidelines for formats and sizes. The requirements are different for the different devices, and quite detailed.
For a quick & dirty solution if you're not ready to ship and just want nice looking graphics for testing, I've found that one 512 x 512 pdf, labeled "image#2x" works pretty well. You need to set the
imageScaling = .scaleProportionallyDown
and Cocoa will take care of the rest. But it's definitely not ready for prime-time.

The NSToolbar.sizeModes are enum: small and regular. Small is 24x24 and regular is 32x32; additionally the retina options allow for #2x (48x48 and 64x64) and potentially #3x future-forward.
Apple documentation on these sizes can be found here and here
Make sure to use enum Regular not "Standard", which is undocumented.

Related

Change display properties of graphics in lithium theme

First of all thanks to the developers of blogdown. I just started my first blogdown-blog on github / netlify and it looks really nice.
There is one issue that I would like to change:
On mobile devices, graphics from R code chunks are displayed in a way that I can see only the left part of the graphics. Ideally, I would want to reduce the size of the graphics on mobile devices so they fit to the height and the width of the screen.
Is this possible? Where would introduce changes?
Here is the link to my blog: https://sbloggel.netlify.com/
(I have only the most minimal knowledge about web programming).
Thanks in advance for any advice or pointers to relevant resources to start learning and best greetings,
Sebastian
I just accidentally found a potential solution that is sufficient to me.
Most (maybe all) figures on my blog will be produced by R code chunks.
By specifying the 'out.width'-parameter in the code chunk that produces the figure, the size of the figure will be fitted to the screen size as far as I can see:
```{r out.width = "100%"}
plot(1:10)
```
Thanks nonetheless!

ImageResizer minwidth / minheight for ebay images

Ebay now requires images to be 500x500.
I want to try to use ImageResizer to resize an image to be a minimum of 500x500 by adding white background padding
The following command achieves this quite easily.
product.jpg?width=500&height=500&scale=canvas
This works great, except when the original image is 800x800 and it will be downsized and lose quality.
What I really want to do is combine scale=canvas with scale=upscaleonly but that doesn't seem to be possible? Am I missing something or will I have to write code myself using the API.
PS. I realize ebay may detect whitespace and still reject the image, but I'm trying that for now - I have a lot of perfectly good 450x450 images that fall short and I don't want to upscale them.
At present, there's no 'upscalecanvasonly' mode.
So far we haven't had anyone else request this, but feel free to add it to our UserVoice site as a feature idea.
You could also implement this with a small IPlugin that subclassed BuilderExtension and implemented LayoutImage to support an additional command. It shouldn't be very difficult.
I haven't used ImageResizer before, but I've worked with images, so I took a quick peek at the basic commands for ImageResizer.
If I understand your problem correctly, when you downsize a 800x800 image it looses quality. This does point to a severe problem because the original image has more data than what is needed to display a high quality 500x500 image. Because of this, we must look at the image file format type and the data compression quality/method.
In your example, you are using the JPEG file format. You may want to specify the format in the command, i.e., format=jpg
In using the JPEG format, Imageresizer gives you control over the quality of the compression:
The documentation states:
quality - Jpeg compression: 0-100 100=best, 90=very good balance, 0=ugly
Take a look at the documentation for the exact verbage for setting the quality.

Switching plone themes according to visitor's screen size

For plone 4.2.5 is there a non-complicated way to set up theme switching between desktop/mobile versions based on visitors screen size?
Something like "if less than 640x480 then" serve the mobile version ?
Talking about 2 non-Diazo themes for instance?
What is ++skin++ for skin switching, may it work?
I am quite new to plone and not really a programmer so a "sane" solution would be really appreciated !
Take a look in portal_css (via the Zope Management Interface) and search for "mobile." In the ""CSS Media" field, you'll find:
handheld, screen and (max-device-width: 480px)
This sets up a media query that causes browsers to use the mobile.css stylesheet if they know (admit) they are a handheld device or if they have a screen width of 480px or less. This is all done through completely standard CSS, and you may use the same principles to achieve completely different page designs for different screen widths. There are several great books on responsive design ("responsive" is the magic word). You may customize this stylesheet, or add your own media query style sheets.
You can also see a thorough and popular use of media queries and responsive design in "Twitter Bootstrap," which provides all sorts of class selectors that you may use to change designs at various screen widths. A bootstrap example is included with the newer version of plone.app.theming that is included with Plone 4.3.
Note, if you want design to change when you reduce a window size (not just the screen size), use "max-width" rather than "max-device-width."
I don't think so. However, you should look into responsive design and media queries. I suspect you can achieve what you want using standards compliant CSS in a single theme.
http://plone.org/products/collective.themeswitcher/
This is an alternative implementation you can use. From the description:
This addon has been designed to easily support new switcher. At the moment the only switcher that is implemented is the "mobile switcher" based on user agent from http://detectmobilebrowsers.com/ (python version).

Displaying Webpages From RSS Feed in iOS Xcode

Currently, I have an RSS Feed Reader in a UITableView within a Navigation Control. I would like to click on the links and Open up a formatted page (containing all of the information from the website formatted for the iOS screen). I'm not sure if I should do this using the RSS data and a UITextView? I'm currently attempting to use UITextView in hopes that I can separate the information (title, author, body) without anything looking promising. I want to be able to move around the data and format it to my liking in the actual application itself. I read around and noted that you can include HTML and custom CSS. Would this be the way to go? I'm not quite sure how to tackle this. I want the page that opens up to be entirely scrollable (Like the IGN application or Slashgear application). Many apps for websites utilize this (and I am a bit new to this). How do they go about this? I also want to note, at some point I will like to cache the data so it may load what is already loaded without being connected to the internet. Does anyone have any ideas?
Edit:
Ok, I believe I found the correct path to go down from playing around and a lot of googling (nothing directly says what a decent way of doing this is). My particular way as of now is the route of a UIScrollView in general. Now the part I don't understand is how to divide up the long text into 'pages' for scrolling (and I am using the paging feature. This situation has led me into this question: How To Separate Strings For UIScrollView/UITextView based on the size of the frame
Ok, I believe I found the correct path to go down from playing around and a lot of googling (nothing directly says what a decent way of doing this is). My particular way as of now is the route of a UIScrollView in general. Now the part I don't understand is how to divide up the long text into 'pages' for scrolling (and I am using the paging feature. This situation has led me into this question: How To Separate Strings For UIScrollView/UITextView based on the size of the frame

Displaying image on Scroll View

I am developing an iPhone application where i want to display three image in each row on scroll view where i need to click action on each image like Photo album in iPhone. I am not getting any sample code.
Hoping for help
subodh
There's plenty of sample code out there, I found this after only basic googling. You want to search for "UIImageView Iphone". It's also worth mentioning that Apple's very own Developer Center is extremely well written, and will teach you everything you need to know about iPhone programming.
Generally it is frowned down upon to say to look more or read documentation, but you really haven't looked at all. Especially because of Apple's own resource that tells you how to do almost anything, especially something like this. It's not something you can pick up and bits and pieces of and expect to be successful with, it really should be learned starting from the beginning and moving forward. This is especially true if you've never programmed before or are unfamiliar with C/Objective-C.
Three20 has a photo browser that is open source and works similarly to the iPhone's photo browser with some nice code examples. The images come from an image source object that can relate them to images in your apps bundle or images on the web. Looks like its Google group is here. I think that to use images in your bundle you use a URL formed like: bundle://image-name.png and not the typical use of the main bundle to get a path to resource.