Java Code Examples for org.robovm.apple.foundation.NSArray#add()

The following examples show how to use org.robovm.apple.foundation.NSArray#add() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AAPLAssetGridViewController.java    From robovm-samples with Apache License 2.0 5 votes vote down vote up
private NSArray<PHAsset> getAssetsAtIndexPaths(NSArray<NSIndexPath> indexPaths) {
    if (indexPaths.size() == 0)
        return null;

    NSArray<PHAsset> assets = new NSMutableArray<>();
    for (NSIndexPath indexPath : indexPaths) {
        PHAsset asset = assetsFetchResults.get(indexPath.getItem());
        assets.add(asset);
    }
    return assets;
}
 
Example 2
Source File: AAPLAssetGridViewController.java    From robovm-samples with Apache License 2.0 5 votes vote down vote up
private NSArray<NSIndexPath> getIndexPathsForElementsInRect(CGRect rect) {
    NSArray<UICollectionViewLayoutAttributes> allLayoutAttributes = getCollectionViewLayout()
            .getLayoutAttributesForElements(
                    rect);
    if (allLayoutAttributes.size() == 0)
        return null;
    NSArray<NSIndexPath> indexPaths = new NSMutableArray<>(allLayoutAttributes.size());
    for (UICollectionViewLayoutAttributes layoutAttributes : allLayoutAttributes) {
        NSIndexPath indexPath = layoutAttributes.getIndexPath();
        indexPaths.add(indexPath);
    }
    return indexPaths;
}
 
Example 3
Source File: APAUtils.java    From robovm-samples with Apache License 2.0 5 votes vote down vote up
public static NSArray<SKTexture> loadFramesFromAtlas (String atlasName, String baseFileName, int numberOfFrames) {
    NSArray<SKTexture> frames = new NSMutableArray<>(numberOfFrames);

    SKTextureAtlas atlas = new SKTextureAtlas(atlasName);
    for (int i = 1; i <= numberOfFrames; i++) {
        String fileName = String.format("%s%04d.png", baseFileName, i);
        SKTexture texture = atlas.getTexture(fileName);
        frames.add(texture);
    }

    return frames;
}