Dactyloidae iOS initial commit

This commit is contained in:
wuggy 2026-06-26 21:04:09 -07:00
commit 7154a0497e
2123 changed files with 197052 additions and 0 deletions

View file

@ -0,0 +1,496 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
C027041017A6FAEC0039CEC1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C027040F17A6FAEC0039CEC1 /* Foundation.framework */; };
C027041217A6FAEC0039CEC1 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C027041117A6FAEC0039CEC1 /* CoreGraphics.framework */; };
C027041417A6FAEC0039CEC1 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C027041317A6FAEC0039CEC1 /* UIKit.framework */; };
C027041A17A6FAEC0039CEC1 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = C027041817A6FAEC0039CEC1 /* InfoPlist.strings */; };
C027041C17A6FAEC0039CEC1 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C027041B17A6FAEC0039CEC1 /* main.m */; };
C027042017A6FAEC0039CEC1 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C027041F17A6FAEC0039CEC1 /* AppDelegate.m */; };
C027042317A6FAEC0039CEC1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C027042117A6FAEC0039CEC1 /* Main.storyboard */; };
C027042617A6FAEC0039CEC1 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C027042517A6FAEC0039CEC1 /* ViewController.m */; };
C027042817A6FAEC0039CEC1 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C027042717A6FAEC0039CEC1 /* Images.xcassets */; };
C027042F17A6FAEC0039CEC1 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C027042E17A6FAEC0039CEC1 /* XCTest.framework */; };
C027043017A6FAEC0039CEC1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C027040F17A6FAEC0039CEC1 /* Foundation.framework */; };
C027043117A6FAEC0039CEC1 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C027041317A6FAEC0039CEC1 /* UIKit.framework */; };
C027043917A6FAEC0039CEC1 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = C027043717A6FAEC0039CEC1 /* InfoPlist.strings */; };
C027043B17A6FAEC0039CEC1 /* ImageAlignmentTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C027043A17A6FAEC0039CEC1 /* ImageAlignmentTests.m */; };
C027044717A6FB170039CEC1 /* UIImageViewAligned.m in Sources */ = {isa = PBXBuildFile; fileRef = C027044617A6FB170039CEC1 /* UIImageViewAligned.m */; };
C027044917A6FE200039CEC1 /* melinda_landscape.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C027044817A6FE200039CEC1 /* melinda_landscape.jpg */; };
C027044B17A6FE780039CEC1 /* melinda_portrait.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C027044A17A6FE780039CEC1 /* melinda_portrait.jpg */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
C027043217A6FAEC0039CEC1 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = C027040417A6FAEC0039CEC1 /* Project object */;
proxyType = 1;
remoteGlobalIDString = C027040B17A6FAEC0039CEC1;
remoteInfo = ImageAlignment;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
C027040C17A6FAEC0039CEC1 /* ImageAlignment.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ImageAlignment.app; sourceTree = BUILT_PRODUCTS_DIR; };
C027040F17A6FAEC0039CEC1 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
C027041117A6FAEC0039CEC1 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
C027041317A6FAEC0039CEC1 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
C027041717A6FAEC0039CEC1 /* ImageAlignment-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "ImageAlignment-Info.plist"; sourceTree = "<group>"; };
C027041917A6FAEC0039CEC1 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
C027041B17A6FAEC0039CEC1 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
C027041D17A6FAEC0039CEC1 /* ImageAlignment-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ImageAlignment-Prefix.pch"; sourceTree = "<group>"; };
C027041E17A6FAEC0039CEC1 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
C027041F17A6FAEC0039CEC1 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
C027042217A6FAEC0039CEC1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
C027042417A6FAEC0039CEC1 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
C027042517A6FAEC0039CEC1 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
C027042717A6FAEC0039CEC1 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
C027042D17A6FAEC0039CEC1 /* ImageAlignmentTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ImageAlignmentTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
C027042E17A6FAEC0039CEC1 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
C027043617A6FAEC0039CEC1 /* ImageAlignmentTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "ImageAlignmentTests-Info.plist"; sourceTree = "<group>"; };
C027043817A6FAEC0039CEC1 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
C027043A17A6FAEC0039CEC1 /* ImageAlignmentTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ImageAlignmentTests.m; sourceTree = "<group>"; };
C027044517A6FB170039CEC1 /* UIImageViewAligned.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIImageViewAligned.h; sourceTree = "<group>"; };
C027044617A6FB170039CEC1 /* UIImageViewAligned.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIImageViewAligned.m; sourceTree = "<group>"; };
C027044817A6FE200039CEC1 /* melinda_landscape.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = melinda_landscape.jpg; sourceTree = "<group>"; };
C027044A17A6FE780039CEC1 /* melinda_portrait.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = melinda_portrait.jpg; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
C027040917A6FAEC0039CEC1 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
C027041217A6FAEC0039CEC1 /* CoreGraphics.framework in Frameworks */,
C027041417A6FAEC0039CEC1 /* UIKit.framework in Frameworks */,
C027041017A6FAEC0039CEC1 /* Foundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
C027042A17A6FAEC0039CEC1 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
C027042F17A6FAEC0039CEC1 /* XCTest.framework in Frameworks */,
C027043117A6FAEC0039CEC1 /* UIKit.framework in Frameworks */,
C027043017A6FAEC0039CEC1 /* Foundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
C027040317A6FAEC0039CEC1 = {
isa = PBXGroup;
children = (
C027041517A6FAEC0039CEC1 /* ImageAlignment */,
C027043417A6FAEC0039CEC1 /* ImageAlignmentTests */,
C027040E17A6FAEC0039CEC1 /* Frameworks */,
C027040D17A6FAEC0039CEC1 /* Products */,
);
sourceTree = "<group>";
};
C027040D17A6FAEC0039CEC1 /* Products */ = {
isa = PBXGroup;
children = (
C027040C17A6FAEC0039CEC1 /* ImageAlignment.app */,
C027042D17A6FAEC0039CEC1 /* ImageAlignmentTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
C027040E17A6FAEC0039CEC1 /* Frameworks */ = {
isa = PBXGroup;
children = (
C027040F17A6FAEC0039CEC1 /* Foundation.framework */,
C027041117A6FAEC0039CEC1 /* CoreGraphics.framework */,
C027041317A6FAEC0039CEC1 /* UIKit.framework */,
C027042E17A6FAEC0039CEC1 /* XCTest.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
C027041517A6FAEC0039CEC1 /* ImageAlignment */ = {
isa = PBXGroup;
children = (
C027044417A6FAFD0039CEC1 /* UIImageViewAligned */,
C027041E17A6FAEC0039CEC1 /* AppDelegate.h */,
C027041F17A6FAEC0039CEC1 /* AppDelegate.m */,
C027042117A6FAEC0039CEC1 /* Main.storyboard */,
C027042417A6FAEC0039CEC1 /* ViewController.h */,
C027042517A6FAEC0039CEC1 /* ViewController.m */,
C027042717A6FAEC0039CEC1 /* Images.xcassets */,
C027044817A6FE200039CEC1 /* melinda_landscape.jpg */,
C027044A17A6FE780039CEC1 /* melinda_portrait.jpg */,
C027041617A6FAEC0039CEC1 /* Supporting Files */,
);
path = ImageAlignment;
sourceTree = "<group>";
};
C027041617A6FAEC0039CEC1 /* Supporting Files */ = {
isa = PBXGroup;
children = (
C027041717A6FAEC0039CEC1 /* ImageAlignment-Info.plist */,
C027041817A6FAEC0039CEC1 /* InfoPlist.strings */,
C027041B17A6FAEC0039CEC1 /* main.m */,
C027041D17A6FAEC0039CEC1 /* ImageAlignment-Prefix.pch */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
C027043417A6FAEC0039CEC1 /* ImageAlignmentTests */ = {
isa = PBXGroup;
children = (
C027043A17A6FAEC0039CEC1 /* ImageAlignmentTests.m */,
C027043517A6FAEC0039CEC1 /* Supporting Files */,
);
path = ImageAlignmentTests;
sourceTree = "<group>";
};
C027043517A6FAEC0039CEC1 /* Supporting Files */ = {
isa = PBXGroup;
children = (
C027043617A6FAEC0039CEC1 /* ImageAlignmentTests-Info.plist */,
C027043717A6FAEC0039CEC1 /* InfoPlist.strings */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
C027044417A6FAFD0039CEC1 /* UIImageViewAligned */ = {
isa = PBXGroup;
children = (
C027044517A6FB170039CEC1 /* UIImageViewAligned.h */,
C027044617A6FB170039CEC1 /* UIImageViewAligned.m */,
);
name = UIImageViewAligned;
path = ../../UIImageViewAligned;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
C027040B17A6FAEC0039CEC1 /* ImageAlignment */ = {
isa = PBXNativeTarget;
buildConfigurationList = C027043E17A6FAEC0039CEC1 /* Build configuration list for PBXNativeTarget "ImageAlignment" */;
buildPhases = (
C027040817A6FAEC0039CEC1 /* Sources */,
C027040917A6FAEC0039CEC1 /* Frameworks */,
C027040A17A6FAEC0039CEC1 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = ImageAlignment;
productName = ImageAlignment;
productReference = C027040C17A6FAEC0039CEC1 /* ImageAlignment.app */;
productType = "com.apple.product-type.application";
};
C027042C17A6FAEC0039CEC1 /* ImageAlignmentTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = C027044117A6FAEC0039CEC1 /* Build configuration list for PBXNativeTarget "ImageAlignmentTests" */;
buildPhases = (
C027042917A6FAEC0039CEC1 /* Sources */,
C027042A17A6FAEC0039CEC1 /* Frameworks */,
C027042B17A6FAEC0039CEC1 /* Resources */,
);
buildRules = (
);
dependencies = (
C027043317A6FAEC0039CEC1 /* PBXTargetDependency */,
);
name = ImageAlignmentTests;
productName = ImageAlignmentTests;
productReference = C027042D17A6FAEC0039CEC1 /* ImageAlignmentTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
C027040417A6FAEC0039CEC1 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0500;
ORGANIZATIONNAME = "Andrei Stanescu";
TargetAttributes = {
C027042C17A6FAEC0039CEC1 = {
TestTargetID = C027040B17A6FAEC0039CEC1;
};
};
};
buildConfigurationList = C027040717A6FAEC0039CEC1 /* Build configuration list for PBXProject "ImageAlignment" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = C027040317A6FAEC0039CEC1;
productRefGroup = C027040D17A6FAEC0039CEC1 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
C027040B17A6FAEC0039CEC1 /* ImageAlignment */,
C027042C17A6FAEC0039CEC1 /* ImageAlignmentTests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
C027040A17A6FAEC0039CEC1 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C027044917A6FE200039CEC1 /* melinda_landscape.jpg in Resources */,
C027044B17A6FE780039CEC1 /* melinda_portrait.jpg in Resources */,
C027042817A6FAEC0039CEC1 /* Images.xcassets in Resources */,
C027041A17A6FAEC0039CEC1 /* InfoPlist.strings in Resources */,
C027042317A6FAEC0039CEC1 /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
C027042B17A6FAEC0039CEC1 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C027043917A6FAEC0039CEC1 /* InfoPlist.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
C027040817A6FAEC0039CEC1 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C027042617A6FAEC0039CEC1 /* ViewController.m in Sources */,
C027042017A6FAEC0039CEC1 /* AppDelegate.m in Sources */,
C027041C17A6FAEC0039CEC1 /* main.m in Sources */,
C027044717A6FB170039CEC1 /* UIImageViewAligned.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
C027042917A6FAEC0039CEC1 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C027043B17A6FAEC0039CEC1 /* ImageAlignmentTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
C027043317A6FAEC0039CEC1 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = C027040B17A6FAEC0039CEC1 /* ImageAlignment */;
targetProxy = C027043217A6FAEC0039CEC1 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
C027041817A6FAEC0039CEC1 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
C027041917A6FAEC0039CEC1 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
C027042117A6FAEC0039CEC1 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
C027042217A6FAEC0039CEC1 /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
C027043717A6FAEC0039CEC1 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
C027043817A6FAEC0039CEC1 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
C027043C17A6FAEC0039CEC1 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "iPhone Developer: AG AG (4AJVDG7NFQ)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: AG AG (4AJVDG7NFQ)";
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
};
name = Debug;
};
C027043D17A6FAEC0039CEC1 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "iPhone Developer: AG AG (4AJVDG7NFQ)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: AG AG (4AJVDG7NFQ)";
COPY_PHASE_STRIP = YES;
ENABLE_NS_ASSERTIONS = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
C027043F17A6FAEC0039CEC1 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "ImageAlignment/ImageAlignment-Prefix.pch";
INFOPLIST_FILE = "ImageAlignment/ImageAlignment-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
name = Debug;
};
C027044017A6FAEC0039CEC1 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "ImageAlignment/ImageAlignment-Prefix.pch";
INFOPLIST_FILE = "ImageAlignment/ImageAlignment-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
name = Release;
};
C027044217A6FAEC0039CEC1 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/ImageAlignment.app/ImageAlignment";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
"$(SYSTEM_APPS_DIR)/Xcode5-DP3.app/Contents/Developer/Library/Frameworks",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "ImageAlignment/ImageAlignment-Prefix.pch";
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
INFOPLIST_FILE = "ImageAlignmentTests/ImageAlignmentTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
};
name = Debug;
};
C027044317A6FAEC0039CEC1 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/ImageAlignment.app/ImageAlignment";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
"$(SYSTEM_APPS_DIR)/Xcode5-DP3.app/Contents/Developer/Library/Frameworks",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "ImageAlignment/ImageAlignment-Prefix.pch";
INFOPLIST_FILE = "ImageAlignmentTests/ImageAlignmentTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
C027040717A6FAEC0039CEC1 /* Build configuration list for PBXProject "ImageAlignment" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C027043C17A6FAEC0039CEC1 /* Debug */,
C027043D17A6FAEC0039CEC1 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
C027043E17A6FAEC0039CEC1 /* Build configuration list for PBXNativeTarget "ImageAlignment" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C027043F17A6FAEC0039CEC1 /* Debug */,
C027044017A6FAEC0039CEC1 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
C027044117A6FAEC0039CEC1 /* Build configuration list for PBXNativeTarget "ImageAlignmentTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C027044217A6FAEC0039CEC1 /* Debug */,
C027044317A6FAEC0039CEC1 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = C027040417A6FAEC0039CEC1 /* Project object */;
}

View file

@ -0,0 +1,14 @@
//
// AppDelegate.h
// ImageAlignment
//
// Created by Andrei Stanescu on 7/29/13.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end

View file

@ -0,0 +1,45 @@
//
// AppDelegate.m
// ImageAlignment
//
// Created by Andrei Stanescu on 7/29/13.
//
#import "AppDelegate.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application
{
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
- (void)applicationWillTerminate:(UIApplication *)application
{
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
@end

View file

@ -0,0 +1,151 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4471.1" systemVersion="12E55" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" initialViewController="vXZ-lx-hvc">
<dependencies>
<deployment defaultVersion="1536" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3697.3"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="ufC-wZ-h7g">
<objects>
<viewController id="vXZ-lx-hvc" customClass="ViewController" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
<rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="melinda_landscape.jpg" id="Ts8-wG-AtN" customClass="UIImageViewAligned">
<rect key="frame" x="35" y="0.0" width="250" height="233"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="alignTop" value="YES"/>
<userDefinedRuntimeAttribute type="boolean" keyPath="alignLeft" value="YES"/>
</userDefinedRuntimeAttributes>
</imageView>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" id="Er1-8a-CIJ">
<rect key="frame" x="265" y="248" width="51" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
<connections>
<action selector="onSwitchLandscape:" destination="vXZ-lx-hvc" eventType="valueChanged" id="NAP-T1-qKv"/>
</connections>
</switch>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" id="DcO-CL-d8v">
<rect key="frame" x="135" y="347" width="51" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
<connections>
<action selector="onSwitchAlignTop:" destination="vXZ-lx-hvc" eventType="valueChanged" id="Hxp-Dk-wpK"/>
</connections>
</switch>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" id="Iz6-oo-AMY">
<rect key="frame" x="169" y="386" width="51" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
<connections>
<action selector="onSwitchAlignRight:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="7EE-bm-eXc"/>
</connections>
</switch>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" id="pCW-Bd-6D9">
<rect key="frame" x="103" y="386" width="51" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
<connections>
<action selector="onSwitchAlignLeft:" destination="vXZ-lx-hvc" eventType="valueChanged" id="SgO-rq-pTr"/>
</connections>
</switch>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" id="P4G-5O-K3g">
<rect key="frame" x="135" y="425" width="51" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
<connections>
<action selector="onSwitchAlignBottom:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="506-Cs-pYl"/>
</connections>
</switch>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Landscape/portrait image" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="d7x-Pi-0pa">
<rect key="frame" x="40" y="253" width="217" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMinY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Top" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="CZH-lI-UmD">
<rect key="frame" x="145" y="319" width="28" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Bottom" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="PLI-dF-Xlg">
<rect key="frame" x="131" y="459" width="57" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="i5i-F5-s69">
<rect key="frame" x="226" y="391" width="42" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Left" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Y8C-zZ-RT7">
<rect key="frame" x="53" y="391" width="42" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="ysz-7Z-kAf">
<rect key="frame" x="47" y="282" width="253" height="29"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="11"/>
<state key="normal" title="Content Mode">
<color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="onButtonContentMode:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="OPy-As-QyU"/>
</connections>
</button>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="1." lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="rjo-y8-6Jj">
<rect key="frame" x="6" y="249" width="21" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="25"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="2." lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="gyl-nA-RRy">
<rect key="frame" x="6" y="282" width="21" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="25"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="3." lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="SIZ-0S-xHl">
<rect key="frame" x="6" y="387" width="21" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="25"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
</view>
<simulatedScreenMetrics key="simulatedDestinationMetrics"/>
<connections>
<outlet property="alignedImageView" destination="Ts8-wG-AtN" id="H7O-Mg-9H5"/>
<outlet property="btnContentMode" destination="ysz-7Z-kAf" id="foy-3f-t0b"/>
<outlet property="swAlignBottom" destination="P4G-5O-K3g" id="Ntf-On-8IF"/>
<outlet property="swAlignLeft" destination="pCW-Bd-6D9" id="CS2-6k-yMy"/>
<outlet property="swAlignRight" destination="Iz6-oo-AMY" id="DN6-2V-dzV"/>
<outlet property="swAlignTop" destination="DcO-CL-d8v" id="cqK-0b-ri4"/>
<outlet property="swLandscape" destination="Er1-8a-CIJ" id="ieI-i5-VWW"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="395" y="125"/>
</scene>
</scenes>
<resources>
<image name="melinda_landscape.jpg" width="960" height="720"/>
</resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document>

View file

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.reydanro.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

View file

@ -0,0 +1,16 @@
//
// Prefix header
//
// The contents of this file are implicitly included at the beginning of every source file.
//
#import <Availability.h>
#ifndef __IPHONE_5_0
#warning "This project uses features only available in iOS SDK 5.0 and later."
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif

View file

@ -0,0 +1,18 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View file

@ -0,0 +1,23 @@
{
"images" : [
{
"orientation" : "portrait",
"idiom" : "iphone",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"subtype" : "retina4",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View file

@ -0,0 +1,30 @@
//
// ViewController.h
// ImageAlignment
//
// Created by Andrei Stanescu on 7/29/13.
//
#import <UIKit/UIKit.h>
#import "UIImageViewAligned.h"
@interface ViewController : UIViewController {
NSArray* _contentModeStrings;
}
@property (weak, nonatomic) IBOutlet UIImageViewAligned *alignedImageView;
@property (weak, nonatomic) IBOutlet UISwitch *swLandscape;
@property (weak, nonatomic) IBOutlet UIButton *btnContentMode;
@property (weak, nonatomic) IBOutlet UISwitch *swAlignTop;
@property (weak, nonatomic) IBOutlet UISwitch *swAlignRight;
@property (weak, nonatomic) IBOutlet UISwitch *swAlignBottom;
@property (weak, nonatomic) IBOutlet UISwitch *swAlignLeft;
- (IBAction)onSwitchLandscape:(id)sender;
- (IBAction)onButtonContentMode:(id)sender;
- (IBAction)onSwitchAlignTop:(id)sender;
- (IBAction)onSwitchAlignRight:(id)sender;
- (IBAction)onSwitchAlignBottom:(id)sender;
- (IBAction)onSwitchAlignLeft:(id)sender;
@end

View file

@ -0,0 +1,79 @@
//
// ViewController.m
// ImageAlignment
//
// Created by Andrei Stanescu on 7/29/13.
//
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
_contentModeStrings = [NSArray arrayWithObjects:
@"UIViewContentModeScaleToFill",
@"UIViewContentModeScaleAspectFit", // contents scaled to fit with fixed aspect. remainder is transparent
@"UIViewContentModeScaleAspectFill", // contents scaled to fill with fixed aspect. some portion of content may be clipped.
@"UIViewContentModeRedraw", // redraw on bounds change (calls -setNeedsDisplay)
@"UIViewContentModeCenter", // contents remain same size. positioned adjusted.
@"UIViewContentModeTop",
@"UIViewContentModeBottom",
@"UIViewContentModeLeft",
@"UIViewContentModeRight",
@"UIViewContentModeTopLeft",
@"UIViewContentModeTopRight",
@"UIViewContentModeBottomLeft",
@"UIViewContentModeBottomRight", nil];
_swLandscape.on = (_alignedImageView.image != nil) && _alignedImageView.image.size.width >= _alignedImageView.image.size.height;
_swAlignLeft.on = _alignedImageView.alignLeft;
_swAlignRight.on = _alignedImageView.alignRight;
_swAlignTop.on = _alignedImageView.alignTop;
_swAlignBottom.on = _alignedImageView.alignBottom;
[self refreshContentModeButtonTitle];
}
- (IBAction)onSwitchLandscape:(id)sender {
if (_swLandscape.on)
_alignedImageView.image = [UIImage imageNamed:@"melinda_landscape.jpg"];
else
_alignedImageView.image = [UIImage imageNamed:@"melinda_portrait.jpg"];
}
- (IBAction)onButtonContentMode:(id)sender
{
_alignedImageView.contentMode = (_alignedImageView.contentMode + 1) % (UIViewContentModeBottomRight+1); // bit of hardcoding..but only for the purposes of this example
[self refreshContentModeButtonTitle];
}
- (IBAction)onSwitchAlignTop:(id)sender {
_alignedImageView.alignTop
= _swAlignTop.on;
}
- (IBAction)onSwitchAlignRight:(id)sender {
_alignedImageView.alignRight = _swAlignRight.on;
}
- (IBAction)onSwitchAlignBottom:(id)sender {
_alignedImageView.alignBottom = _swAlignBottom.on;
}
- (IBAction)onSwitchAlignLeft:(id)sender {
_alignedImageView.alignLeft = _swAlignLeft.on;
}
- (void)refreshContentModeButtonTitle
{
[_btnContentMode setTitle:_contentModeStrings[_alignedImageView.contentMode] forState:UIControlStateNormal];
}
@end

View file

@ -0,0 +1,2 @@
/* Localized versions of Info.plist keys */

View file

@ -0,0 +1,17 @@
//
// main.m
// ImageAlignment
//
// Created by Andrei Stanescu on 7/29/13.
//
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char * argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.reydanro.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View file

@ -0,0 +1,35 @@
//
// ImageAlignmentTests.m
// ImageAlignmentTests
//
// Created by Andrei Stanescu on 7/29/13.
//
#import <XCTest/XCTest.h>
@interface ImageAlignmentTests : XCTestCase
@end
@implementation ImageAlignmentTests
- (void)setUp
{
[super setUp];
// Set-up code here.
}
- (void)tearDown
{
// Tear-down code here.
[super tearDown];
}
- (void)testExample
{
XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__);
}
@end

View file

@ -0,0 +1,2 @@
/* Localized versions of Info.plist keys */

View file

@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2013 Andrei Stanescu
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -0,0 +1,41 @@
What is it?
===========
It is a subclass of `UIImageView` that allows you to customize the alignment of the displayed image inside the view's frame.
This works even if the `contentMode` is set to `AspectFit`, `AspectFill` or `ScaleToFill`.
Why a subclass of UIImageView, and not a standard UIView?
=========================================================
Because there are many cool categories built on top of UIImageView. Subclassing a standard UIView would mean losing them.
For example, AFNetworking's async `UIImageView` category works perfectly using this container class, and you don't have to worry about a thing.
How does it work?
=================
When initialized, `UIImageViewAligned` will create a inner `UIImageView` which will actually hold the image displayed.
The main class then just repositions this inner `UIImageView` to achieve your desired alignment.
At runtime, you can change the image, contentMode or alignment and the image will reposition itself correctly.
The `image` property of UIImageViewAligned is overwritten to forward the calls to the inner `UIImageView`, so you can just drag-n-drop into your app.
Compatibility
=============
From what I tested, it works on iOS 6.0+.
Also, it supports autorotation and will reposition the image correctly.
Using Interface Builder
=======================
You can setup the alignment from Interface Builder using the `Identity Inspector` tab for the UIImageViewAligned.
There, you can add custom boolean properties that will be set when the view is instantiated.
The possible boolean names are:
`alignLeft`
`alignRight`
`alignTop`
`alignBottom`
Below is a screenshot of an example. You will not get an immediate feedback in IB regarding your alignment, but it will work at runtime.
![alt tag](https://raw.github.com/reydanro/UIImageViewAligned/master/docs/IBsetup.png)

View file

@ -0,0 +1,21 @@
Pod::Spec.new do |s|
s.name = "UIImageViewAligned"
s.version = "0.0.1"
s.summary = "A UIImageView subclass which allows you to align the image left/right/top/bottom, even when contentMode is AspectFit."
s.description = "It is a subclass of UIImageView that allows you to customize the alignment of the displayed image inside the view's frame. This works even if the contentMode is set to AspectFit, AspectFill or ScaleToFill."
s.homepage = "https://github.com/reydanro/UIImageViewAligned"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = "Andrei Stanescu"
s.social_media_url = "http://twitter.com/MTStudios_"
s.platform = :ios
s.source = { :git => "https://github.com/reydanro/UIImageViewAligned.git", :tag => "[ADD THIS]" }
s.source_files = "UIImageViewAligned"
s.framework = "UIKit"
end

View file

@ -0,0 +1,49 @@
//
// UIImageViewAligned.h
// awards
//
// Created by Andrei Stanescu on 7/29/13.
//
#import <UIKit/UIKit.h>
typedef enum
{
UIImageViewAlignmentMaskCenter = 0,
UIImageViewAlignmentMaskLeft = 1,
UIImageViewAlignmentMaskRight = 2,
UIImageViewAlignmentMaskTop = 4,
UIImageViewAlignmentMaskBottom = 8,
UIImageViewAlignmentMaskBottomLeft = UIImageViewAlignmentMaskBottom | UIImageViewAlignmentMaskLeft,
UIImageViewAlignmentMaskBottomRight = UIImageViewAlignmentMaskBottom | UIImageViewAlignmentMaskRight,
UIImageViewAlignmentMaskTopLeft = UIImageViewAlignmentMaskTop | UIImageViewAlignmentMaskLeft,
UIImageViewAlignmentMaskTopRight = UIImageViewAlignmentMaskTop | UIImageViewAlignmentMaskRight,
}UIImageViewAlignmentMask;
typedef UIImageViewAlignmentMask UIImageViewAignmentMask __attribute__((deprecated("Use UIImageViewAlignmentMask. Use of UIImageViewAignmentMask (misspelled) is deprecated.")));
@interface UIImageViewAligned : UIImageView
// This property holds the current alignment
@property (nonatomic) UIImageViewAlignmentMask alignment;
// Properties needed for Interface Builder quick setup
@property (nonatomic) BOOL alignLeft;
@property (nonatomic) BOOL alignRight;
@property (nonatomic) BOOL alignTop;
@property (nonatomic) BOOL alignBottom;
// Make the UIImageView scale only up or down
// This are used only if the content mode is Scaled
@property (nonatomic) BOOL enableScaleUp;
@property (nonatomic) BOOL enableScaleDown;
// Just in case you need access to the inner image view
@property (nonatomic, readonly) UIImageView* realImageView;
@end

View file

@ -0,0 +1,245 @@
//
// UIImageViewAligned.m
// awards
//
// Created by Andrei Stanescu on 7/29/13.
//
#import "UIImageViewAligned.h"
@implementation UIImageViewAligned
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self)
{
[self commonInit];
}
return self;
}
- (id)initWithImage:(UIImage *)image
{
self = [super initWithImage:image];
if (self)
{
[self commonInit];
}
return self;
}
- (id)initWithImage:(UIImage *)image highlightedImage:(UIImage *)highlightedImage
{
self = [super initWithImage:image highlightedImage:highlightedImage];
if (self)
[self commonInit];
return self;
}
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super initWithCoder:aDecoder];
if (self)
[self commonInit];
return self;
}
- (void)commonInit
{
_enableScaleDown = TRUE;
_enableScaleUp = TRUE;
_alignment = UIImageViewAlignmentMaskCenter;
_realImageView = [[UIImageView alloc] initWithFrame:self.bounds];
_realImageView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
_realImageView.contentMode = self.contentMode;
[self addSubview:_realImageView];
// Move any image we might have from this container to the real image view
if (super.image != nil)
{
UIImage* img = super.image;
super.image = nil;
self.image = img;
}
}
- (UIImage*)image
{
return _realImageView.image;
}
- (void)setImage:(UIImage *)image
{
[_realImageView setImage:image];
[self setNeedsLayout];
}
- (void)setContentMode:(UIViewContentMode)contentMode
{
[super setContentMode:contentMode];
_realImageView.contentMode = contentMode;
[self setNeedsLayout];
}
- (void)setAlignment:(UIImageViewAlignmentMask)alignment
{
if (_alignment == alignment)
return ;
_alignment = alignment;
[self setNeedsLayout];
}
- (void)layoutSubviews
{
CGSize realsize = [self realContentSize];
// Start centered
CGRect realframe = CGRectMake((self.bounds.size.width - realsize.width)/2, (self.bounds.size.height - realsize.height) / 2, realsize.width, realsize.height);
if ((_alignment & UIImageViewAlignmentMaskLeft) != 0)
realframe.origin.x = 0;
else if ((_alignment & UIImageViewAlignmentMaskRight) != 0)
realframe.origin.x = CGRectGetMaxX(self.bounds) - realframe.size.width;
if ((_alignment & UIImageViewAlignmentMaskTop) != 0)
realframe.origin.y = 0;
else if ((_alignment & UIImageViewAlignmentMaskBottom) != 0)
realframe.origin.y = CGRectGetMaxY(self.bounds) - realframe.size.height;
_realImageView.frame = realframe;
// Make sure we clear the contents of this container layer, since it refreshes from the image property once in a while.
self.layer.contents = nil;
}
- (CGSize)realContentSize
{
CGSize size = self.bounds.size;
if (self.image == nil)
return size;
switch (self.contentMode)
{
case UIViewContentModeScaleAspectFit:
{
float scalex = self.bounds.size.width / _realImageView.image.size.width;
float scaley = self.bounds.size.height / _realImageView.image.size.height;
float scale = MIN(scalex, scaley);
if ((scale > 1.0f && !_enableScaleUp) ||
(scale < 1.0f && !_enableScaleDown))
scale = 1.0f;
size = CGSizeMake(_realImageView.image.size.width * scale, _realImageView.image.size.height * scale);
break;
}
case UIViewContentModeScaleAspectFill:
{
float scalex = self.bounds.size.width / _realImageView.image.size.width;
float scaley = self.bounds.size.height / _realImageView.image.size.height;
float scale = MAX(scalex, scaley);
if ((scale > 1.0f && !_enableScaleUp) ||
(scale < 1.0f && !_enableScaleDown))
scale = 1.0f;
size = CGSizeMake(_realImageView.image.size.width * scale, _realImageView.image.size.height * scale);
break;
}
case UIViewContentModeScaleToFill:
{
float scalex = self.bounds.size.width / _realImageView.image.size.width;
float scaley = self.bounds.size.height / _realImageView.image.size.height;
if ((scalex > 1.0f && !_enableScaleUp) ||
(scalex < 1.0f && !_enableScaleDown))
scalex = 1.0f;
if ((scaley > 1.0f && !_enableScaleUp) ||
(scaley < 1.0f && !_enableScaleDown))
scaley = 1.0f;
size = CGSizeMake(_realImageView.image.size.width * scalex, _realImageView.image.size.height * scaley);
break;
}
default:
size = _realImageView.image.size;
break;
}
return size;
}
#pragma mark - UIImageView overloads
- (void)setHighlighted:(BOOL)highlighted {
[super setHighlighted:highlighted];
self.layer.contents = nil;
}
#pragma mark - Properties needed for Interface Builder
- (BOOL)alignLeft
{
return (_alignment & UIImageViewAlignmentMaskLeft) != 0;
}
- (void)setAlignLeft:(BOOL)alignLeft
{
if (alignLeft)
self.alignment |= UIImageViewAlignmentMaskLeft;
else
self.alignment &= ~UIImageViewAlignmentMaskLeft;
}
- (BOOL)alignRight
{
return (_alignment & UIImageViewAlignmentMaskRight) != 0;
}
- (void)setAlignRight:(BOOL)alignRight
{
if (alignRight)
self.alignment |= UIImageViewAlignmentMaskRight;
else
self.alignment &= ~UIImageViewAlignmentMaskRight;
}
- (BOOL)alignTop
{
return (_alignment & UIImageViewAlignmentMaskTop) != 0;
}
- (void)setAlignTop:(BOOL)alignTop
{
if (alignTop)
self.alignment |= UIImageViewAlignmentMaskTop;
else
self.alignment &= ~UIImageViewAlignmentMaskTop;
}
- (BOOL)alignBottom
{
return (_alignment & UIImageViewAlignmentMaskBottom) != 0;
}
- (void)setAlignBottom:(BOOL)alignBottom
{
if (alignBottom)
self.alignment |= UIImageViewAlignmentMaskBottom;
else
self.alignment &= ~UIImageViewAlignmentMaskBottom;
}
- (CGSize)sizeThatFits:(CGSize)size {
return [self.realImageView sizeThatFits:size];
}
@end

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 KiB