jeudi 7 juillet 2016

iOS: Get displayed image size in pixels


In my app, I'm displaying an image of a rectangle from the assets library. The image is 100x100 pixels. I'm only using the 1x slot for this asset.

I want to display this image at 300x300 pixels. Doing this using points is quite simple but I can't figure out how to get UIImageView to set the size in pixels.

Alternatively, if I can't set the size in pixels to display, I'd like to get the size in pixels that the image is being displayed.

I have tried using .scale on the UIImageView and UIImage instances, but it's always 1. Even though I have set constraints to 150 and 300.


clang compile failed on mariadb


system is CentOS(VirtualBox) x64
I had "yum install" and "yum check" cmake clang gcc libstdc++ and compat-libstdc++*
I had link cmake to clang
I had compile a "HelloWorld" program by clang successed

then,
I try to compile mariadb'code use : "cmake . -DBUILD_CONFIG=mysql_release".
I got error like this:
...
CMake Error at /usr/share/cmake/Modules/CMakeTestCXXCompiler.cmake:54 (message): The C++ compiler "/usr/bin/clang++" is not able to compile a simple test program.
...
/usr/bin/ld: cannot find -lstdc++
...

How can I fix this problem? Thanks very much!
(Please forgive me for my poor English T_T)


Cocoa pods objective c files in Swift project. Bridging issue


I downloaded code from here:

https://github.com/QuickBlox/quickblox-ios-sdk

wich include sample-chat-swift example folder where seems somehow guys created a framework.

In my case if I just use cocoa pods to pull code into my project Xcode says to me that we can't find any of downloaded classes. So I am sure that is problem with bridging but my question what are the steps I need to do to create framework like guys did in theirs example.

Or do I need to bridge each files manually? If so I guess it can take so much time.


How to add elements of an array with themselves?


I want to add an element of an array with itself. Here is some of my code :

for (j = 0; j <= N - 1; ++j) {
    Phi[j] = Randf();
    G_0[j] = 0;
} ...
...
for (l = 0; l = N - 1; ++l) {
    G_0[l] += Phi[l] * Phi[l];
}

But compiler yields this error :

Error   C2114   '+=': pointer on left; needs integral value on right

I don't know what to do. I've researched this type of error but either I cannot find anything useful or I'm so clueless that I don't understand what I've found.

How can I add an element of an array with itself? Thanks in advance.


Trim transparency of an UIImage


I was wondering what would be the best way to trim the "canvas" of an UIImage (pretty much like any image editor allows out there)

Example

Now, the previous example is not a single UIImage. It's actually 2 UIViews. So clipping the superview against the blue box would do the trick, but I guess I am looking into the best possible way to do this. Given that there could be several blue boxes in the "canvas".

Is there a faster way than going through every pixel?

Thanks!


mercredi 6 juillet 2016

Application icons is pixelated


I'm trying to set an icon for my app, however the icons derived from the original image is pixelated and looks bad, I tried to provide the app icon gear application with images of different sizes, however the result is still unpleasant! Should I provide it with images of higher resolution or lower resolution to get better results? In the question in the link under there's an answer providing a matrix provided by Apple for icon sizes. My question is, should I use these sizes strictly, or consider them as a lower border not to go under, or consider them as a ceiling not to exceed? the question's link


entry point (_main) undefined xcode 6


I can't for the life of me find a solution to this! I'm using Swift. All of a sudden I get this error:

Undefined symbols for architecture i386:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture i386

It doesn't matter what simulator/device I try to run for, I still get it:

Undefined symbols for architecture x86_64:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64

What is this?! I've almost removed everything from my project. I.e. all frameworks and everything. It's still there.

Please help me