Repository: nicklockwood/iCarousel Branch: master Commit: c9e043e1fa76 Files: 610 Total size: 3.0 MB Directory structure: gitextract_q8v4ewru/ ├── .gitignore ├── Examples/ │ ├── Advanced iOS Demo/ │ │ ├── en.lproj/ │ │ │ ├── InfoPlist.strings │ │ │ ├── MainWindow.xib │ │ │ └── iCarouselExampleViewController.xib │ │ ├── iCarouselExample-Info.plist │ │ ├── iCarouselExample-Prefix.pch │ │ ├── iCarouselExample.xcodeproj/ │ │ │ └── project.pbxproj │ │ ├── iCarouselExampleAppDelegate.h │ │ ├── iCarouselExampleAppDelegate.m │ │ ├── iCarouselExampleViewController.h │ │ ├── iCarouselExampleViewController.m │ │ └── main.m │ ├── Basic iOS Example/ │ │ ├── en.lproj/ │ │ │ ├── InfoPlist.strings │ │ │ ├── MainWindow.xib │ │ │ └── iCarouselExampleViewController.xib │ │ ├── iCarouselExample-Info.plist │ │ ├── iCarouselExample-Prefix.pch │ │ ├── iCarouselExample.xcodeproj/ │ │ │ └── project.pbxproj │ │ ├── iCarouselExampleAppDelegate.h │ │ ├── iCarouselExampleAppDelegate.m │ │ ├── iCarouselExampleViewController.h │ │ ├── iCarouselExampleViewController.m │ │ └── main.m │ ├── Buttons Demo/ │ │ ├── en.lproj/ │ │ │ ├── InfoPlist.strings │ │ │ ├── MainWindow.xib │ │ │ └── iCarouselExampleViewController.xib │ │ ├── iCarouselButtonsDemo-Info.plist │ │ ├── iCarouselButtonsDemo-Prefix.pch │ │ ├── iCarouselButtonsDemo.xcodeproj/ │ │ │ └── project.pbxproj │ │ ├── iCarouselExampleAppDelegate.h │ │ ├── iCarouselExampleAppDelegate.m │ │ ├── iCarouselExampleViewController.h │ │ ├── iCarouselExampleViewController.m │ │ └── main.m │ ├── Chameleon Demo/ │ │ ├── Chameleon/ │ │ │ ├── .gitignore │ │ │ ├── AVFoundation/ │ │ │ │ ├── AVFoundation.xcodeproj/ │ │ │ │ │ ├── project.pbxproj │ │ │ │ │ └── project.xcworkspace/ │ │ │ │ │ └── contents.xcworkspacedata │ │ │ │ ├── AVFoundation_Prefix.pch │ │ │ │ ├── Classes/ │ │ │ │ │ ├── AVAudioPlayer.h │ │ │ │ │ ├── AVAudioPlayer.m │ │ │ │ │ ├── AVAudioSession.h │ │ │ │ │ ├── AVAudioSession.m │ │ │ │ │ └── AVFoundation.h │ │ │ │ └── Info.plist │ │ │ ├── AddressBookUI/ │ │ │ │ ├── AddressBookUI.xcodeproj/ │ │ │ │ │ ├── project.pbxproj │ │ │ │ │ └── project.xcworkspace/ │ │ │ │ │ └── contents.xcworkspacedata │ │ │ │ ├── AddressBookUI_Prefix.pch │ │ │ │ ├── Classes/ │ │ │ │ │ ├── ABUnknownPersonViewController.h │ │ │ │ │ ├── ABUnknownPersonViewController.m │ │ │ │ │ └── AddressBookUI.h │ │ │ │ └── Info.plist │ │ │ ├── AssetsLibrary/ │ │ │ │ ├── AssetsLibrary.xcodeproj/ │ │ │ │ │ └── project.pbxproj │ │ │ │ ├── AssetsLibrary_Prefix.pch │ │ │ │ ├── Classes/ │ │ │ │ │ ├── ALAsset.h │ │ │ │ │ ├── ALAsset.m │ │ │ │ │ ├── ALAssetRepresentation.h │ │ │ │ │ ├── ALAssetRepresentation.m │ │ │ │ │ ├── ALAssetsFilter.h │ │ │ │ │ ├── ALAssetsFilter.m │ │ │ │ │ ├── ALAssetsGroup.h │ │ │ │ │ ├── ALAssetsGroup.m │ │ │ │ │ ├── ALAssetsLibrary.h │ │ │ │ │ ├── ALAssetsLibrary.m │ │ │ │ │ └── AssetsLibrary.h │ │ │ │ └── Info.plist │ │ │ ├── LICENSE │ │ │ ├── MediaPlayer/ │ │ │ │ ├── Classes/ │ │ │ │ │ ├── MPMediaPlayback.h │ │ │ │ │ ├── MPMoviePlayerController.h │ │ │ │ │ ├── MPMoviePlayerController.m │ │ │ │ │ ├── MPMusicPlayerController.h │ │ │ │ │ ├── MPMusicPlayerController.m │ │ │ │ │ ├── MediaPlayer.h │ │ │ │ │ ├── UIInternalMovieView.h │ │ │ │ │ └── UIInternalMovieView.m │ │ │ │ ├── Info.plist │ │ │ │ ├── MediaPlayer.xcodeproj/ │ │ │ │ │ ├── project.pbxproj │ │ │ │ │ └── project.xcworkspace/ │ │ │ │ │ └── contents.xcworkspacedata │ │ │ │ └── MediaPlayer_Prefix.pch │ │ │ ├── MessageUI/ │ │ │ │ ├── Classes/ │ │ │ │ │ ├── MFMailComposeViewController.h │ │ │ │ │ ├── MFMailComposeViewController.m │ │ │ │ │ └── MessageUI.h │ │ │ │ ├── Info.plist │ │ │ │ ├── MFMessageComposeViewController.h │ │ │ │ ├── MFMessageComposeViewController.m │ │ │ │ ├── MessageUI.xcodeproj/ │ │ │ │ │ ├── project.pbxproj │ │ │ │ │ └── project.xcworkspace/ │ │ │ │ │ └── contents.xcworkspacedata │ │ │ │ └── MessageUI_Prefix.pch │ │ │ ├── README.md │ │ │ ├── StoreKit/ │ │ │ │ ├── Classes/ │ │ │ │ │ ├── SKPayment.h │ │ │ │ │ ├── SKPayment.m │ │ │ │ │ ├── SKPaymentQueue.h │ │ │ │ │ ├── SKPaymentQueue.m │ │ │ │ │ ├── SKPaymentTransaction.h │ │ │ │ │ ├── SKPaymentTransaction.m │ │ │ │ │ ├── SKProduct.h │ │ │ │ │ ├── SKProduct.m │ │ │ │ │ ├── SKProductsRequest.h │ │ │ │ │ ├── SKProductsRequest.m │ │ │ │ │ ├── SKProductsResponse.h │ │ │ │ │ ├── SKProductsResponse.m │ │ │ │ │ ├── SKRequest.h │ │ │ │ │ ├── SKRequest.m │ │ │ │ │ └── StoreKit.h │ │ │ │ ├── Info.plist │ │ │ │ ├── StoreKit.xcodeproj/ │ │ │ │ │ ├── project.pbxproj │ │ │ │ │ └── project.xcworkspace/ │ │ │ │ │ └── contents.xcworkspacedata │ │ │ │ └── StoreKit_Prefix.pch │ │ │ └── UIKit/ │ │ │ ├── .gitignore │ │ │ ├── Classes/ │ │ │ │ ├── AppKitIntegration.h │ │ │ │ ├── NSIndexPath+UITableView.h │ │ │ │ ├── NSIndexPath+UITableView.m │ │ │ │ ├── UIAcceleration.h │ │ │ │ ├── UIAcceleration.m │ │ │ │ ├── UIAccelerometer.h │ │ │ │ ├── UIAccelerometer.m │ │ │ │ ├── UIAccessibility.h │ │ │ │ ├── UIAccessibility.m │ │ │ │ ├── UIAccessibilityElement.h │ │ │ │ ├── UIAccessibilityElement.m │ │ │ │ ├── UIAction.h │ │ │ │ ├── UIAction.m │ │ │ │ ├── UIActionSheet.h │ │ │ │ ├── UIActionSheet.m │ │ │ │ ├── UIActionSheetAppKitIntegration.h │ │ │ │ ├── UIActivityIndicatorView.h │ │ │ │ ├── UIActivityIndicatorView.m │ │ │ │ ├── UIAlertView.h │ │ │ │ ├── UIAlertView.m │ │ │ │ ├── UIAppearance.h │ │ │ │ ├── UIAppearanceInstance.h │ │ │ │ ├── UIAppearanceInstance.m │ │ │ │ ├── UIAppearanceProperty.h │ │ │ │ ├── UIAppearanceProperty.m │ │ │ │ ├── UIAppearanceProxy.h │ │ │ │ ├── UIAppearanceProxy.m │ │ │ │ ├── UIApplication+UIPrivate.h │ │ │ │ ├── UIApplication.h │ │ │ │ ├── UIApplication.m │ │ │ │ ├── UIApplicationAppKitIntegration.h │ │ │ │ ├── UIApplicationDelegate.h │ │ │ │ ├── UIBackgroundTask.h │ │ │ │ ├── UIBackgroundTask.m │ │ │ │ ├── UIBarButtonItem.h │ │ │ │ ├── UIBarButtonItem.m │ │ │ │ ├── UIBarItem.h │ │ │ │ ├── UIBarItem.m │ │ │ │ ├── UIBezierPath.h │ │ │ │ ├── UIBezierPath.m │ │ │ │ ├── UIBulletGlyphGenerator.h │ │ │ │ ├── UIBulletGlyphGenerator.m │ │ │ │ ├── UIButton.h │ │ │ │ ├── UIButton.m │ │ │ │ ├── UIColor+UIPrivate.h │ │ │ │ ├── UIColor.h │ │ │ │ ├── UIColor.m │ │ │ │ ├── UIColorAppKitIntegration.h │ │ │ │ ├── UIColorRep.h │ │ │ │ ├── UIColorRep.m │ │ │ │ ├── UIControl+UIPrivate.h │ │ │ │ ├── UIControl.h │ │ │ │ ├── UIControl.m │ │ │ │ ├── UIControlAction.h │ │ │ │ ├── UIControlAction.m │ │ │ │ ├── UICustomNSClipView.h │ │ │ │ ├── UICustomNSClipView.m │ │ │ │ ├── UICustomNSTextView.h │ │ │ │ ├── UICustomNSTextView.m │ │ │ │ ├── UIDataDetectors.h │ │ │ │ ├── UIDatePicker.h │ │ │ │ ├── UIDatePicker.m │ │ │ │ ├── UIDevice.h │ │ │ │ ├── UIDevice.m │ │ │ │ ├── UIEvent+UIPrivate.h │ │ │ │ ├── UIEvent.h │ │ │ │ ├── UIEvent.m │ │ │ │ ├── UIFont+UIPrivate.h │ │ │ │ ├── UIFont.h │ │ │ │ ├── UIFont.m │ │ │ │ ├── UIFontAppKitIntegration.h │ │ │ │ ├── UIGeometry.h │ │ │ │ ├── UIGeometry.m │ │ │ │ ├── UIGestureRecognizer+UIPrivate.h │ │ │ │ ├── UIGestureRecognizer.h │ │ │ │ ├── UIGestureRecognizer.m │ │ │ │ ├── UIGestureRecognizerSubclass.h │ │ │ │ ├── UIGraphics.h │ │ │ │ ├── UIGraphics.m │ │ │ │ ├── UIImage+UIPrivate.h │ │ │ │ ├── UIImage+UIPrivate.m │ │ │ │ ├── UIImage.h │ │ │ │ ├── UIImage.m │ │ │ │ ├── UIImageAppKitIntegration.h │ │ │ │ ├── UIImageAppKitIntegration.m │ │ │ │ ├── UIImagePickerController.h │ │ │ │ ├── UIImagePickerController.m │ │ │ │ ├── UIImageRep.h │ │ │ │ ├── UIImageRep.m │ │ │ │ ├── UIImageView+UIPrivate.h │ │ │ │ ├── UIImageView.h │ │ │ │ ├── UIImageView.m │ │ │ │ ├── UIInputController.h │ │ │ │ ├── UIInputController.m │ │ │ │ ├── UIInterface.h │ │ │ │ ├── UIInterface.m │ │ │ │ ├── UIKey+UIPrivate.h │ │ │ │ ├── UIKey.h │ │ │ │ ├── UIKey.m │ │ │ │ ├── UIKit.h │ │ │ │ ├── UIKitView.h │ │ │ │ ├── UIKitView.m │ │ │ │ ├── UILabel.h │ │ │ │ ├── UILabel.m │ │ │ │ ├── UILongPressGestureRecognizer.h │ │ │ │ ├── UILongPressGestureRecognizer.m │ │ │ │ ├── UIMenuController.h │ │ │ │ ├── UIMenuController.m │ │ │ │ ├── UIMenuItem.h │ │ │ │ ├── UIMenuItem.m │ │ │ │ ├── UINSClipView.h │ │ │ │ ├── UINSClipView.m │ │ │ │ ├── UINavigationBar+UIPrivate.h │ │ │ │ ├── UINavigationBar.h │ │ │ │ ├── UINavigationBar.m │ │ │ │ ├── UINavigationController.h │ │ │ │ ├── UINavigationController.m │ │ │ │ ├── UINavigationItem+UIPrivate.h │ │ │ │ ├── UINavigationItem.h │ │ │ │ ├── UINavigationItem.m │ │ │ │ ├── UINibLoading.h │ │ │ │ ├── UINibLoading.m │ │ │ │ ├── UINinePartImage.h │ │ │ │ ├── UINinePartImage.m │ │ │ │ ├── UIPageControl.h │ │ │ │ ├── UIPageControl.m │ │ │ │ ├── UIPanGestureRecognizer.h │ │ │ │ ├── UIPanGestureRecognizer.m │ │ │ │ ├── UIPasteboard.h │ │ │ │ ├── UIPasteboard.m │ │ │ │ ├── UIPhotosAlbum.h │ │ │ │ ├── UIPhotosAlbum.m │ │ │ │ ├── UIPickerView.h │ │ │ │ ├── UIPickerView.m │ │ │ │ ├── UIPinchGestureRecognizer.h │ │ │ │ ├── UIPinchGestureRecognizer.m │ │ │ │ ├── UIPopoverController+UIPrivate.h │ │ │ │ ├── UIPopoverController.h │ │ │ │ ├── UIPopoverController.m │ │ │ │ ├── UIPopoverNSWindow.h │ │ │ │ ├── UIPopoverNSWindow.m │ │ │ │ ├── UIPopoverOverlayNSView.h │ │ │ │ ├── UIPopoverOverlayNSView.m │ │ │ │ ├── UIPopoverView.h │ │ │ │ ├── UIPopoverView.m │ │ │ │ ├── UIProgressView.h │ │ │ │ ├── UIProgressView.m │ │ │ │ ├── UIResponder.h │ │ │ │ ├── UIResponder.m │ │ │ │ ├── UIResponderAppKitIntegration.h │ │ │ │ ├── UIResponderAppKitIntegration.m │ │ │ │ ├── UIRotationGestureRecognizer.h │ │ │ │ ├── UIRotationGestureRecognizer.m │ │ │ │ ├── UIRoundedRectButton.h │ │ │ │ ├── UIRoundedRectButton.m │ │ │ │ ├── UIScreen+UIPrivate.h │ │ │ │ ├── UIScreen.h │ │ │ │ ├── UIScreen.m │ │ │ │ ├── UIScreenAppKitIntegration.h │ │ │ │ ├── UIScreenAppKitIntegration.m │ │ │ │ ├── UIScreenMode+UIPrivate.h │ │ │ │ ├── UIScreenMode.h │ │ │ │ ├── UIScreenMode.m │ │ │ │ ├── UIScrollView+UIPrivate.h │ │ │ │ ├── UIScrollView.h │ │ │ │ ├── UIScrollView.m │ │ │ │ ├── UIScrollViewAnimation.h │ │ │ │ ├── UIScrollViewAnimation.m │ │ │ │ ├── UIScrollViewAnimationDeceleration.h │ │ │ │ ├── UIScrollViewAnimationDeceleration.m │ │ │ │ ├── UIScrollViewAnimationScroll.h │ │ │ │ ├── UIScrollViewAnimationScroll.m │ │ │ │ ├── UIScrollWheelGestureRecognizer.h │ │ │ │ ├── UIScrollWheelGestureRecognizer.m │ │ │ │ ├── UIScroller.h │ │ │ │ ├── UIScroller.m │ │ │ │ ├── UISearchBar.h │ │ │ │ ├── UISearchBar.m │ │ │ │ ├── UISearchDisplayController.h │ │ │ │ ├── UISearchDisplayController.m │ │ │ │ ├── UISegmentedControl.h │ │ │ │ ├── UISegmentedControl.m │ │ │ │ ├── UISlider.h │ │ │ │ ├── UISlider.m │ │ │ │ ├── UISplitViewController.h │ │ │ │ ├── UISplitViewController.m │ │ │ │ ├── UIStringDrawing.h │ │ │ │ ├── UIStringDrawing.m │ │ │ │ ├── UISwipeGestureRecognizer.h │ │ │ │ ├── UISwipeGestureRecognizer.m │ │ │ │ ├── UISwitch.h │ │ │ │ ├── UISwitch.m │ │ │ │ ├── UITabBar.h │ │ │ │ ├── UITabBar.m │ │ │ │ ├── UITabBarController.h │ │ │ │ ├── UITabBarController.m │ │ │ │ ├── UITabBarItem.h │ │ │ │ ├── UITabBarItem.m │ │ │ │ ├── UITableView.h │ │ │ │ ├── UITableView.m │ │ │ │ ├── UITableViewCell+UIPrivate.h │ │ │ │ ├── UITableViewCell.h │ │ │ │ ├── UITableViewCell.m │ │ │ │ ├── UITableViewCellSeparator.h │ │ │ │ ├── UITableViewCellSeparator.m │ │ │ │ ├── UITableViewController.h │ │ │ │ ├── UITableViewController.m │ │ │ │ ├── UITableViewSection.h │ │ │ │ ├── UITableViewSection.m │ │ │ │ ├── UITableViewSectionLabel.h │ │ │ │ ├── UITableViewSectionLabel.m │ │ │ │ ├── UITapGestureRecognizer.h │ │ │ │ ├── UITapGestureRecognizer.m │ │ │ │ ├── UITextField.h │ │ │ │ ├── UITextField.m │ │ │ │ ├── UITextInputTraits.h │ │ │ │ ├── UITextLayer.h │ │ │ │ ├── UITextLayer.m │ │ │ │ ├── UITextView.h │ │ │ │ ├── UITextView.m │ │ │ │ ├── UIThreePartImage.h │ │ │ │ ├── UIThreePartImage.m │ │ │ │ ├── UIToolbar.h │ │ │ │ ├── UIToolbar.m │ │ │ │ ├── UIToolbarButton.h │ │ │ │ ├── UIToolbarButton.m │ │ │ │ ├── UITouch+UIPrivate.h │ │ │ │ ├── UITouch.h │ │ │ │ ├── UITouch.m │ │ │ │ ├── UITransitionView.h │ │ │ │ ├── UITransitionView.m │ │ │ │ ├── UIView+UIPrivate.h │ │ │ │ ├── UIView.h │ │ │ │ ├── UIView.m │ │ │ │ ├── UIViewAdapter.h │ │ │ │ ├── UIViewAdapter.m │ │ │ │ ├── UIViewAnimationGroup.h │ │ │ │ ├── UIViewAnimationGroup.m │ │ │ │ ├── UIViewBlockAnimationDelegate.h │ │ │ │ ├── UIViewBlockAnimationDelegate.m │ │ │ │ ├── UIViewController+UIPrivate.h │ │ │ │ ├── UIViewController.h │ │ │ │ ├── UIViewController.m │ │ │ │ ├── UIViewLayoutManager.h │ │ │ │ ├── UIViewLayoutManager.m │ │ │ │ ├── UIWebView.h │ │ │ │ ├── UIWebView.m │ │ │ │ ├── UIWindow+UIPrivate.h │ │ │ │ ├── UIWindow.h │ │ │ │ └── UIWindow.m │ │ │ ├── Info.plist │ │ │ ├── UIKit.xcodeproj/ │ │ │ │ ├── project.pbxproj │ │ │ │ └── project.xcworkspace/ │ │ │ │ └── contents.xcworkspacedata │ │ │ └── UIKit_Prefix.pch │ │ ├── iCarouselChameleonDemo/ │ │ │ ├── MacAppDelegate.h │ │ │ ├── MacAppDelegate.m │ │ │ ├── en.lproj/ │ │ │ │ ├── Credits.rtf │ │ │ │ ├── InfoPlist.strings │ │ │ │ └── MainMenu.xib │ │ │ ├── iCarouselChameleonDemo-Info.plist │ │ │ ├── iCarouselChameleonDemo-Prefix.pch │ │ │ ├── iCarouselExampleAppDelegate.h │ │ │ ├── iCarouselExampleAppDelegate.m │ │ │ ├── iCarouselExampleViewController.h │ │ │ ├── iCarouselExampleViewController.m │ │ │ └── main.m │ │ └── iCarouselChameleonDemo.xcodeproj/ │ │ ├── project.pbxproj │ │ └── project.xcworkspace/ │ │ └── contents.xcworkspacedata │ ├── Controls Demo/ │ │ ├── ItemView.xib │ │ ├── en.lproj/ │ │ │ ├── InfoPlist.strings │ │ │ ├── MainWindow.xib │ │ │ └── iCarouselExampleViewController.xib │ │ ├── iCarouselControlsDemo.xcodeproj/ │ │ │ ├── project.pbxproj │ │ │ └── project.xcworkspace/ │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata/ │ │ │ └── WorkspaceSettings.xcsettings │ │ ├── iCarouselExampleAppDelegate.h │ │ ├── iCarouselExampleAppDelegate.m │ │ ├── iCarouselExampleViewController.h │ │ ├── iCarouselExampleViewController.m │ │ ├── iCarouselTest-Info.plist │ │ ├── iCarouselTest-Prefix.pch │ │ └── main.m │ ├── Downloads & Effects/ │ │ ├── Images.plist │ │ ├── en.lproj/ │ │ │ ├── InfoPlist.strings │ │ │ ├── MainWindow.xib │ │ │ └── iCarouselExampleViewController.xib │ │ ├── iCarouselExample-Info.plist │ │ ├── iCarouselExample-Prefix.pch │ │ ├── iCarouselExample.xcodeproj/ │ │ │ ├── project.pbxproj │ │ │ └── project.xcworkspace/ │ │ │ └── contents.xcworkspacedata │ │ ├── iCarouselExampleAppDelegate.h │ │ ├── iCarouselExampleAppDelegate.m │ │ ├── iCarouselExampleViewController.h │ │ ├── iCarouselExampleViewController.m │ │ └── main.m │ ├── Dynamic Downloads/ │ │ ├── Images.plist │ │ ├── en.lproj/ │ │ │ ├── InfoPlist.strings │ │ │ ├── MainWindow.xib │ │ │ └── iCarouselExampleViewController.xib │ │ ├── iCarouselExample-Info.plist │ │ ├── iCarouselExample-Prefix.pch │ │ ├── iCarouselExample.xcodeproj/ │ │ │ └── project.pbxproj │ │ ├── iCarouselExampleAppDelegate.h │ │ ├── iCarouselExampleAppDelegate.m │ │ ├── iCarouselExampleViewController.h │ │ ├── iCarouselExampleViewController.m │ │ └── main.m │ ├── Dynamic Image Effects/ │ │ ├── iCarouselExample/ │ │ │ ├── AppDelegate.h │ │ │ ├── AppDelegate.m │ │ │ ├── ViewController.h │ │ │ ├── ViewController.m │ │ │ ├── en.lproj/ │ │ │ │ ├── InfoPlist.strings │ │ │ │ └── ViewController.xib │ │ │ ├── iCarouselExample-Info.plist │ │ │ ├── iCarouselExample-Prefix.pch │ │ │ └── main.m │ │ └── iCarouselExample.xcodeproj/ │ │ └── project.pbxproj │ ├── Dynamic View Reflections/ │ │ ├── en.lproj/ │ │ │ ├── InfoPlist.strings │ │ │ ├── MainWindow.xib │ │ │ └── iCarouselExampleViewController.xib │ │ ├── iCarouselExampleAppDelegate.h │ │ ├── iCarouselExampleAppDelegate.m │ │ ├── iCarouselExampleViewController.h │ │ ├── iCarouselExampleViewController.m │ │ ├── iCarouselReflectionsDemo-Info.plist │ │ ├── iCarouselReflectionsDemo-Prefix.pch │ │ ├── iCarouselReflectionsDemo.xcodeproj/ │ │ │ └── project.pbxproj │ │ └── main.m │ ├── Fading Demo/ │ │ ├── en.lproj/ │ │ │ ├── InfoPlist.strings │ │ │ ├── MainWindow.xib │ │ │ └── iCarouselExampleViewController.xib │ │ ├── iCarouselExample-Info.plist │ │ ├── iCarouselExample-Prefix.pch │ │ ├── iCarouselExample.xcodeproj/ │ │ │ └── project.pbxproj │ │ ├── iCarouselExampleAppDelegate.h │ │ ├── iCarouselExampleAppDelegate.m │ │ ├── iCarouselExampleViewController.h │ │ ├── iCarouselExampleViewController.m │ │ └── main.m │ ├── Libraries/ │ │ ├── AsyncImageView/ │ │ │ ├── AsyncImageView.h │ │ │ └── AsyncImageView.m │ │ ├── FXImageView/ │ │ │ ├── FXImageView.h │ │ │ ├── FXImageView.m │ │ │ ├── UIImage+FX.h │ │ │ └── UIImage+FX.m │ │ └── ReflectionView/ │ │ ├── ReflectionView.h │ │ └── ReflectionView.m │ ├── Mac Demo/ │ │ ├── iCarouselMac/ │ │ │ ├── en.lproj/ │ │ │ │ ├── Credits.rtf │ │ │ │ ├── InfoPlist.strings │ │ │ │ └── MainMenu.xib │ │ │ ├── iCarouselMac-Info.plist │ │ │ ├── iCarouselMac-Prefix.pch │ │ │ ├── iCarouselMacAppDelegate.h │ │ │ ├── iCarouselMacAppDelegate.m │ │ │ ├── iCarouselWindowController.h │ │ │ ├── iCarouselWindowController.m │ │ │ └── main.m │ │ └── iCarouselMac.xcodeproj/ │ │ └── project.pbxproj │ ├── Multiple Carousels/ │ │ ├── MultipleCarousels-Info.plist │ │ ├── MultipleCarousels-Prefix.pch │ │ ├── MultipleCarousels.xcodeproj/ │ │ │ └── project.pbxproj │ │ ├── en.lproj/ │ │ │ ├── InfoPlist.strings │ │ │ ├── MainWindow.xib │ │ │ └── iCarouselExampleViewController.xib │ │ ├── iCarouselExampleAppDelegate.h │ │ ├── iCarouselExampleAppDelegate.m │ │ ├── iCarouselExampleViewController.h │ │ ├── iCarouselExampleViewController.m │ │ └── main.m │ ├── Nested Carousels/ │ │ ├── en.lproj/ │ │ │ ├── InfoPlist.strings │ │ │ ├── MainWindow.xib │ │ │ └── iCarouselExampleViewController.xib │ │ ├── iCarouselExample-Info.plist │ │ ├── iCarouselExample-Prefix.pch │ │ ├── iCarouselExample.xcodeproj/ │ │ │ └── project.pbxproj │ │ ├── iCarouselExampleAppDelegate.h │ │ ├── iCarouselExampleAppDelegate.m │ │ ├── iCarouselExampleViewController.h │ │ ├── iCarouselExampleViewController.m │ │ └── main.m │ ├── No Nib Demo/ │ │ ├── en.lproj/ │ │ │ └── InfoPlist.strings │ │ ├── iCarouselExampleAppDelegate.h │ │ ├── iCarouselExampleAppDelegate.m │ │ ├── iCarouselExampleViewController.h │ │ ├── iCarouselExampleViewController.m │ │ ├── iCarouselNoNibDemo-Info.plist │ │ ├── iCarouselNoNibDemo-Prefix.pch │ │ ├── iCarouselNoNibDemo.xcodeproj/ │ │ │ ├── project.pbxproj │ │ │ └── project.xcworkspace/ │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata/ │ │ │ └── WorkspaceSettings.xcsettings │ │ └── main.m │ ├── Offsets Demo/ │ │ ├── en.lproj/ │ │ │ ├── InfoPlist.strings │ │ │ ├── MainWindow.xib │ │ │ └── iCarouselExampleViewController.xib │ │ ├── iCarouselExample-Info.plist │ │ ├── iCarouselExample-Prefix.pch │ │ ├── iCarouselExample.xcodeproj/ │ │ │ └── project.pbxproj │ │ ├── iCarouselExampleAppDelegate.h │ │ ├── iCarouselExampleAppDelegate.m │ │ ├── iCarouselExampleViewController.h │ │ ├── iCarouselExampleViewController.m │ │ └── main.m │ ├── Options Demo/ │ │ ├── en.lproj/ │ │ │ ├── InfoPlist.strings │ │ │ ├── MainWindow.xib │ │ │ └── iCarouselExampleViewController.xib │ │ ├── iCarouselExample-Info.plist │ │ ├── iCarouselExample-Prefix.pch │ │ ├── iCarouselExampleAppDelegate.h │ │ ├── iCarouselExampleAppDelegate.m │ │ ├── iCarouselExampleViewController.h │ │ ├── iCarouselExampleViewController.m │ │ ├── iCarouselOptionsDemo.xcodeproj/ │ │ │ ├── project.pbxproj │ │ │ └── project.xcworkspace/ │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata/ │ │ │ └── WorkspaceSettings.xcsettings │ │ └── main.m │ ├── Paging Example/ │ │ ├── en.lproj/ │ │ │ ├── InfoPlist.strings │ │ │ ├── MainWindow.xib │ │ │ └── iCarouselExampleViewController.xib │ │ ├── iCarouselExample-Info.plist │ │ ├── iCarouselExample-Prefix.pch │ │ ├── iCarouselExample.xcodeproj/ │ │ │ └── project.pbxproj │ │ ├── iCarouselExampleAppDelegate.h │ │ ├── iCarouselExampleAppDelegate.m │ │ ├── iCarouselExampleViewController.h │ │ ├── iCarouselExampleViewController.m │ │ └── main.m │ ├── Storyboard Demo/ │ │ ├── StoryboardExample/ │ │ │ ├── AppDelegate.h │ │ │ ├── AppDelegate.m │ │ │ ├── StoryboardExample-Info.plist │ │ │ ├── StoryboardExample-Prefix.pch │ │ │ ├── ViewController.h │ │ │ ├── ViewController.m │ │ │ ├── en.lproj/ │ │ │ │ ├── InfoPlist.strings │ │ │ │ └── MainStoryboard.storyboard │ │ │ └── main.m │ │ └── StoryboardExample.xcodeproj/ │ │ └── project.pbxproj │ ├── Swift Example/ │ │ ├── SwiftExample/ │ │ │ ├── AppDelegate.swift │ │ │ ├── Base.lproj/ │ │ │ │ └── Main.storyboard │ │ │ ├── Images.xcassets/ │ │ │ │ ├── AppIcon.appiconset/ │ │ │ │ │ └── Contents.json │ │ │ │ ├── LaunchImage.launchimage/ │ │ │ │ │ └── Contents.json │ │ │ │ ├── background.imageset/ │ │ │ │ │ └── Contents.json │ │ │ │ └── page.imageset/ │ │ │ │ └── Contents.json │ │ │ ├── Info.plist │ │ │ ├── SwiftExample-Bridging-Header.h │ │ │ └── ViewController.swift │ │ └── SwiftExample.xcodeproj/ │ │ └── project.pbxproj │ ├── Swift3 Example/ │ │ ├── SwiftExample/ │ │ │ ├── AppDelegate.swift │ │ │ ├── Base.lproj/ │ │ │ │ └── Main.storyboard │ │ │ ├── Images.xcassets/ │ │ │ │ ├── AppIcon.appiconset/ │ │ │ │ │ └── Contents.json │ │ │ │ ├── LaunchImage.launchimage/ │ │ │ │ │ └── Contents.json │ │ │ │ ├── background.imageset/ │ │ │ │ │ └── Contents.json │ │ │ │ └── page.imageset/ │ │ │ │ └── Contents.json │ │ │ ├── Info.plist │ │ │ ├── SwiftExample-Bridging-Header.h │ │ │ └── ViewController.swift │ │ └── SwiftExample.xcodeproj/ │ │ └── project.pbxproj │ └── Tables Demo/ │ ├── en.lproj/ │ │ ├── InfoPlist.strings │ │ ├── MainWindow.xib │ │ └── iCarouselExampleViewController.xib │ ├── iCarouselExampleAppDelegate.h │ ├── iCarouselExampleAppDelegate.m │ ├── iCarouselExampleViewController.h │ ├── iCarouselExampleViewController.m │ ├── iCarouselTest-Info.plist │ ├── iCarouselTest-Prefix.pch │ ├── iCarouselTest.xcodeproj/ │ │ └── project.pbxproj │ └── main.m ├── LICENCE.md ├── README.md ├── Tests/ │ ├── Events/ │ │ ├── en.lproj/ │ │ │ ├── InfoPlist.strings │ │ │ ├── MainWindow.xib │ │ │ └── iCarouselExampleViewController.xib │ │ ├── iCarouselExampleAppDelegate.h │ │ ├── iCarouselExampleAppDelegate.m │ │ ├── iCarouselExampleViewController.h │ │ ├── iCarouselExampleViewController.m │ │ ├── iCarouselTest-Info.plist │ │ ├── iCarouselTest-Prefix.pch │ │ ├── iCarouselTest.xcodeproj/ │ │ │ ├── project.pbxproj │ │ │ └── project.xcworkspace/ │ │ │ └── contents.xcworkspacedata │ │ └── main.m │ └── Scrolling/ │ ├── en.lproj/ │ │ ├── InfoPlist.strings │ │ ├── MainWindow.xib │ │ └── iCarouselExampleViewController.xib │ ├── iCarouselExampleAppDelegate.h │ ├── iCarouselExampleAppDelegate.m │ ├── iCarouselExampleViewController.h │ ├── iCarouselExampleViewController.m │ ├── iCarouselTest-Info.plist │ ├── iCarouselTest-Prefix.pch │ ├── iCarouselTest.xcodeproj/ │ │ ├── project.pbxproj │ │ └── project.xcworkspace/ │ │ └── contents.xcworkspacedata │ └── main.m ├── iCarousel/ │ ├── Info.plist │ ├── iCarousel.h │ └── iCarousel.m ├── iCarousel.podspec.json ├── iCarousel.xcodeproj/ │ ├── project.pbxproj │ ├── project.xcworkspace/ │ │ └── contents.xcworkspacedata │ └── xcshareddata/ │ └── xcschemes/ │ ├── iCarousel iOS.xcscheme │ └── iCarousel macOS.xcscheme └── iCarousel.xcworkspace/ └── contents.xcworkspacedata ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ # Xcode .DS_Store build/ *.pbxuser !default.pbxuser *.mode1v3 !default.mode1v3 *.mode2v3 !default.mode2v3 *.perspectivev3 !default.perspectivev3 !default.xcworkspace xcuserdata profile *.moved-aside DerivedData .idea/ Pods Podfile.lock ================================================ FILE: Examples/Advanced iOS Demo/en.lproj/InfoPlist.strings ================================================ /* Localized versions of Info.plist keys */ ================================================ FILE: Examples/Advanced iOS Demo/en.lproj/MainWindow.xib ================================================ 1552 12E55 3084 1187.39 626.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin 2083 YES IBProxyObject IBUICustomObject IBUIViewController IBUIWindow YES com.apple.InterfaceBuilder.IBCocoaTouchPlugin PluginDependencyRecalculationVersion YES IBFilesOwner IBCocoaTouchFramework IBFirstResponder IBCocoaTouchFramework IBCocoaTouchFramework iCarouselExampleViewController 1 1 IBCocoaTouchFramework NO 292 {320, 480} 1 MSAxIDEAA NO NO IBCocoaTouchFramework YES YES delegate 4 viewController 11 window 14 rootViewController 16 YES 0 YES -1 File's Owner 3 iCarouselExample App Delegate -2 10 12 YES YES -1.CustomClassName -1.IBPluginDependency -2.CustomClassName -2.IBPluginDependency 10.CustomClassName 10.IBPluginDependency 12.IBPluginDependency 3.CustomClassName 3.IBPluginDependency YES UIApplication com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIResponder com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarouselExampleViewController com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarouselExampleAppDelegate com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES 16 YES iCarousel UIView YES YES dataSource delegate YES id id YES YES dataSource delegate YES dataSource id delegate id IBProjectSource ./Classes/iCarousel.h iCarouselExampleAppDelegate NSObject YES YES viewController window YES iCarouselExampleViewController UIWindow YES YES viewController window YES viewController iCarouselExampleViewController window UIWindow IBProjectSource ./Classes/iCarouselExampleAppDelegate.h iCarouselExampleViewController UIViewController YES YES insertItem removeItem switchCarouselType toggleOrientation toggleWrap YES id id id id id YES YES insertItem removeItem switchCarouselType toggleOrientation toggleWrap YES insertItem id removeItem id switchCarouselType id toggleOrientation id toggleWrap id YES YES carousel navItem orientationBarItem wrapBarItem YES iCarousel UINavigationItem UIBarItem UIBarItem YES YES carousel navItem orientationBarItem wrapBarItem YES carousel iCarousel navItem UINavigationItem orientationBarItem UIBarItem wrapBarItem UIBarItem IBProjectSource ./Classes/iCarouselExampleViewController.h 0 IBCocoaTouchFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 YES 3 2083 ================================================ FILE: Examples/Advanced iOS Demo/en.lproj/iCarouselExampleViewController.xib ================================================ 1552 12E55 3084 1187.39 626.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin 2083 YES IBProxyObject IBUIBarButtonItem IBUIImageView IBUINavigationBar IBUINavigationItem IBUIToolbar IBUIView YES com.apple.InterfaceBuilder.IBCocoaTouchPlugin PluginDependencyRecalculationVersion YES IBFilesOwner IBCocoaTouchFramework IBFirstResponder IBCocoaTouchFramework 274 YES 274 {320, 468} NO YES YES IBCocoaTouchFramework NSImage background.png 274 {{0, 44}, {320, 372}} 3 MSAwAA 2 IBCocoaTouchFramework 266 {{0, 416}, {320, 44}} NO NO IBCocoaTouchFramework YES Switch Type IBCocoaTouchFramework 1 IBCocoaTouchFramework 5 Horizontal IBCocoaTouchFramework 80 1 Wrap: ON IBCocoaTouchFramework 80 1 290 {320, 44} IBCocoaTouchFramework YES Insert Item IBCocoaTouchFramework 1 Delete Item IBCocoaTouchFramework 1 IBCocoaTouchFramework {{0, 20}, {320, 460}} 3 MC43NQA NO IBCocoaTouchFramework YES view 7 carousel 9 navItem 20 orientationBarItem 36 wrapBarItem 37 dataSource 10 delegate 11 switchCarouselType 18 toggleWrap 23 insertItem 28 removeItem 30 toggleOrientation 34 YES 0 YES -1 File's Owner -2 6 YES 8 YES iCarousel 15 YES 16 YES 21 24 YES 27 17 25 22 26 31 YES YES -1.CustomClassName -1.IBPluginDependency -2.CustomClassName -2.IBPluginDependency 15.IBPluginDependency 16.IBPluginDependency 17.IBPluginDependency 21.IBPluginDependency 22.IBPluginDependency 24.IBPluginDependency 25.IBPluginDependency 26.IBPluginDependency 27.IBPluginDependency 31.IBPluginDependency 6.IBPluginDependency 8.CustomClassName 8.IBPluginDependency YES iCarouselExampleViewController com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIResponder com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarousel com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES 37 YES iCarousel UIView YES YES dataSource delegate YES id id YES YES dataSource delegate YES dataSource id delegate id IBProjectSource ./Classes/iCarousel.h iCarouselExampleViewController UIViewController YES YES insertItem removeItem switchCarouselType toggleOrientation toggleWrap YES id id id id id YES YES insertItem removeItem switchCarouselType toggleOrientation toggleWrap YES insertItem id removeItem id switchCarouselType id toggleOrientation id toggleWrap id YES YES carousel navItem orientationBarItem wrapBarItem YES iCarousel UINavigationItem UIBarItem UIBarItem YES YES carousel navItem orientationBarItem wrapBarItem YES carousel iCarousel navItem UINavigationItem orientationBarItem UIBarItem wrapBarItem UIBarItem IBProjectSource ./Classes/iCarouselExampleViewController.h 0 IBCocoaTouchFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 YES 3 background.png {50, 468} 2083 ================================================ FILE: Examples/Advanced iOS Demo/iCarouselExample-Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleDisplayName ${PRODUCT_NAME} CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIconFile CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1.0 LSRequiresIPhoneOS NSMainNibFile MainWindow UIStatusBarHidden UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIViewControllerBasedStatusBarAppearance ================================================ FILE: Examples/Advanced iOS Demo/iCarouselExample-Prefix.pch ================================================ // // Prefix header for all source files of the 'iCarouselExample' target in the 'iCarouselExample' project // #import #ifndef __IPHONE_3_0 #warning "This project uses features only available in iPhone SDK 3.0 and later." #endif #ifdef __OBJC__ #import #import #endif ================================================ FILE: Examples/Advanced iOS Demo/iCarouselExample.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 01308D9313491C3500453707 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9213491C3500453707 /* UIKit.framework */; }; 01308D9513491C3500453707 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9413491C3500453707 /* Foundation.framework */; }; 01308D9713491C3500453707 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9613491C3500453707 /* CoreGraphics.framework */; }; 01308DC013491F7200453707 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308DBF13491F7200453707 /* QuartzCore.framework */; }; 0148358813A36C2000E687AC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358313A36C2000E687AC /* main.m */; }; 0148359313A36C3700E687AC /* iCarouselExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */; }; 0148359413A36C3700E687AC /* iCarouselExampleAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */; }; 0148359513A36C3700E687AC /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0148358F13A36C3700E687AC /* MainWindow.xib */; }; 0148359613A36C3700E687AC /* iCarouselExampleViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */; }; 018AE98A179D7EBA00FB7311 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 018AE989179D7EBA00FB7311 /* Default-568h@2x.png */; }; B2E5E6C1146145C900EADB7A /* iCarousel.m in Sources */ = {isa = PBXBuildFile; fileRef = B2E5E6C0146145C900EADB7A /* iCarousel.m */; }; B2E5E72D1461544B00EADB7A /* background.png in Resources */ = {isa = PBXBuildFile; fileRef = B2E5E72B1461544B00EADB7A /* background.png */; }; B2E5E72E1461544B00EADB7A /* page.png in Resources */ = {isa = PBXBuildFile; fileRef = B2E5E72C1461544B00EADB7A /* page.png */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 01308D9213491C3500453707 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 01308D9413491C3500453707 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 01308D9613491C3500453707 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 01308DBF13491F7200453707 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 0148358313A36C2000E687AC /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = SOURCE_ROOT; }; 0148358413A36C2000E687AC /* iCarouselExample-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "iCarouselExample-Info.plist"; sourceTree = SOURCE_ROOT; }; 0148358513A36C2000E687AC /* iCarouselExample-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "iCarouselExample-Prefix.pch"; sourceTree = SOURCE_ROOT; }; 0148358713A36C2000E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = SOURCE_ROOT; }; 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleViewController.m; sourceTree = SOURCE_ROOT; }; 0148358C13A36C3700E687AC /* iCarouselExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleViewController.h; sourceTree = SOURCE_ROOT; }; 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleAppDelegate.m; sourceTree = SOURCE_ROOT; }; 0148358E13A36C3700E687AC /* iCarouselExampleAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleAppDelegate.h; sourceTree = SOURCE_ROOT; }; 0148359013A36C3700E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainWindow.xib; sourceTree = SOURCE_ROOT; }; 0148359213A36C3700E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/iCarouselExampleViewController.xib; sourceTree = SOURCE_ROOT; }; 018AE989179D7EBA00FB7311 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = SOURCE_ROOT; }; 018BBCB413A375AF005CA505 /* iCarouselExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iCarouselExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; B2E5E6BF146145C900EADB7A /* iCarousel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarousel.h; sourceTree = ""; }; B2E5E6C0146145C900EADB7A /* iCarousel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarousel.m; sourceTree = ""; }; B2E5E72B1461544B00EADB7A /* background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = background.png; path = ../Resources/background.png; sourceTree = SOURCE_ROOT; }; B2E5E72C1461544B00EADB7A /* page.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = page.png; path = ../Resources/page.png; sourceTree = SOURCE_ROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 01308D8B13491C3500453707 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 01308DC013491F7200453707 /* QuartzCore.framework in Frameworks */, 01308D9313491C3500453707 /* UIKit.framework in Frameworks */, 01308D9513491C3500453707 /* Foundation.framework in Frameworks */, 01308D9713491C3500453707 /* CoreGraphics.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 01308D8313491C3500453707 = { isa = PBXGroup; children = ( B2E5E6BE146145C900EADB7A /* iCarousel */, 01308D9813491C3500453707 /* iCarouselExample */, 01308D9113491C3500453707 /* Frameworks */, 01308D8F13491C3500453707 /* Products */, ); indentWidth = 4; sourceTree = ""; tabWidth = 4; }; 01308D8F13491C3500453707 /* Products */ = { isa = PBXGroup; children = ( 018BBCB413A375AF005CA505 /* iCarouselExample.app */, ); name = Products; sourceTree = ""; }; 01308D9113491C3500453707 /* Frameworks */ = { isa = PBXGroup; children = ( 01308DBF13491F7200453707 /* QuartzCore.framework */, 01308D9213491C3500453707 /* UIKit.framework */, 01308D9413491C3500453707 /* Foundation.framework */, 01308D9613491C3500453707 /* CoreGraphics.framework */, ); name = Frameworks; sourceTree = ""; }; 01308D9813491C3500453707 /* iCarouselExample */ = { isa = PBXGroup; children = ( 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */, 0148358C13A36C3700E687AC /* iCarouselExampleViewController.h */, 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */, 0148358E13A36C3700E687AC /* iCarouselExampleAppDelegate.h */, 0148358F13A36C3700E687AC /* MainWindow.xib */, 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */, B2E5E72A1461543E00EADB7A /* Resources */, 01308D9913491C3500453707 /* Supporting Files */, ); path = iCarouselExample; sourceTree = ""; }; 01308D9913491C3500453707 /* Supporting Files */ = { isa = PBXGroup; children = ( 018AE989179D7EBA00FB7311 /* Default-568h@2x.png */, 0148358313A36C2000E687AC /* main.m */, 0148358413A36C2000E687AC /* iCarouselExample-Info.plist */, 0148358513A36C2000E687AC /* iCarouselExample-Prefix.pch */, 0148358613A36C2000E687AC /* InfoPlist.strings */, ); name = "Supporting Files"; sourceTree = ""; }; B2E5E6BE146145C900EADB7A /* iCarousel */ = { isa = PBXGroup; children = ( B2E5E6BF146145C900EADB7A /* iCarousel.h */, B2E5E6C0146145C900EADB7A /* iCarousel.m */, ); name = iCarousel; path = ../../iCarousel; sourceTree = ""; }; B2E5E72A1461543E00EADB7A /* Resources */ = { isa = PBXGroup; children = ( B2E5E72B1461544B00EADB7A /* background.png */, B2E5E72C1461544B00EADB7A /* page.png */, ); name = Resources; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 01308D8D13491C3500453707 /* iCarouselExample */ = { isa = PBXNativeTarget; buildConfigurationList = 01308DAF13491C3500453707 /* Build configuration list for PBXNativeTarget "iCarouselExample" */; buildPhases = ( 01308D8A13491C3500453707 /* Sources */, 01308D8B13491C3500453707 /* Frameworks */, 01308D8C13491C3500453707 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = iCarouselExample; productName = iCarouselExample; productReference = 018BBCB413A375AF005CA505 /* iCarouselExample.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 01308D8513491C3500453707 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0800; }; buildConfigurationList = 01308D8813491C3500453707 /* Build configuration list for PBXProject "iCarouselExample" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); mainGroup = 01308D8313491C3500453707; productRefGroup = 01308D8F13491C3500453707 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 01308D8D13491C3500453707 /* iCarouselExample */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 01308D8C13491C3500453707 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 0148359513A36C3700E687AC /* MainWindow.xib in Resources */, 0148359613A36C3700E687AC /* iCarouselExampleViewController.xib in Resources */, B2E5E72D1461544B00EADB7A /* background.png in Resources */, B2E5E72E1461544B00EADB7A /* page.png in Resources */, 018AE98A179D7EBA00FB7311 /* Default-568h@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 01308D8A13491C3500453707 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 0148358813A36C2000E687AC /* main.m in Sources */, 0148359313A36C3700E687AC /* iCarouselExampleViewController.m in Sources */, 0148359413A36C3700E687AC /* iCarouselExampleAppDelegate.m in Sources */, B2E5E6C1146145C900EADB7A /* iCarousel.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 0148358613A36C2000E687AC /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( 0148358713A36C2000E687AC /* en */, ); name = InfoPlist.strings; sourceTree = ""; }; 0148358F13A36C3700E687AC /* MainWindow.xib */ = { isa = PBXVariantGroup; children = ( 0148359013A36C3700E687AC /* en */, ); name = MainWindow.xib; sourceTree = ""; }; 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */ = { isa = PBXVariantGroup; children = ( 0148359213A36C3700E687AC /* en */, ); name = iCarouselExampleViewController.xib; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 01308DAD13491C3500453707 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES; CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES; CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES; CLANG_WARN_CXX0X_EXTENSIONS = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = YES; CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES; CLANG_WARN_OBJC_RECEIVER_WEAK = YES; CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES; CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__EXIT_TIME_DESTRUCTORS = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = DEBUG; GCC_SHORT_ENUMS = YES; GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES; GCC_TREAT_WARNINGS_AS_ERRORS = NO; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES; GCC_WARN_INHIBIT_ALL_WARNINGS = YES; GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES; GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; GCC_WARN_PEDANTIC = YES; GCC_WARN_SHADOW = YES; GCC_WARN_SIGN_COMPARE = YES; GCC_WARN_STRICT_SELECTOR_MATCH = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNKNOWN_PRAGMAS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_LABEL = YES; GCC_WARN_UNUSED_PARAMETER = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; ONLY_ACTIVE_ARCH = YES; RUN_CLANG_STATIC_ANALYZER = YES; SDKROOT = iphoneos; WARNING_CFLAGS = "-Weverything"; }; name = Debug; }; 01308DAE13491C3500453707 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES; CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES; CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES; CLANG_WARN_CXX0X_EXTENSIONS = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = YES; CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES; CLANG_WARN_OBJC_RECEIVER_WEAK = YES; CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES; CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__EXIT_TIME_DESTRUCTORS = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_SHORT_ENUMS = YES; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES; GCC_TREAT_WARNINGS_AS_ERRORS = NO; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES; GCC_WARN_INHIBIT_ALL_WARNINGS = YES; GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES; GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; GCC_WARN_PEDANTIC = YES; GCC_WARN_SHADOW = YES; GCC_WARN_SIGN_COMPARE = YES; GCC_WARN_STRICT_SELECTOR_MATCH = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNKNOWN_PRAGMAS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_LABEL = YES; GCC_WARN_UNUSED_PARAMETER = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; RUN_CLANG_STATIC_ANALYZER = YES; SDKROOT = iphoneos; WARNING_CFLAGS = "-Weverything"; }; name = Release; }; 01308DB013491C3500453707 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselExample-Prefix.pch"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_INHIBIT_ALL_WARNINGS = NO; INFOPLIST_FILE = "iCarouselExample-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = iCarouselExample; TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = app; }; name = Debug; }; 01308DB113491C3500453707 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselExample-Prefix.pch"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_INHIBIT_ALL_WARNINGS = NO; INFOPLIST_FILE = "iCarouselExample-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = iCarouselExample; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; WRAPPER_EXTENSION = app; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 01308D8813491C3500453707 /* Build configuration list for PBXProject "iCarouselExample" */ = { isa = XCConfigurationList; buildConfigurations = ( 01308DAD13491C3500453707 /* Debug */, 01308DAE13491C3500453707 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 01308DAF13491C3500453707 /* Build configuration list for PBXNativeTarget "iCarouselExample" */ = { isa = XCConfigurationList; buildConfigurations = ( 01308DB013491C3500453707 /* Debug */, 01308DB113491C3500453707 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 01308D8513491C3500453707 /* Project object */; } ================================================ FILE: Examples/Advanced iOS Demo/iCarouselExampleAppDelegate.h ================================================ // // iCarouselExampleAppDelegate.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import @class iCarouselExampleViewController; @interface iCarouselExampleAppDelegate : NSObject @property (nonatomic, strong) IBOutlet UIWindow *window; @property (nonatomic, strong) IBOutlet iCarouselExampleViewController *viewController; @end ================================================ FILE: Examples/Advanced iOS Demo/iCarouselExampleAppDelegate.m ================================================ // // iCarouselExampleAppDelegate.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleAppDelegate.h" #import "iCarouselExampleViewController.h" @implementation iCarouselExampleAppDelegate @synthesize window; @synthesize viewController; - (BOOL)application:(__unused UIApplication *)application didFinishLaunchingWithOptions:(__unused NSDictionary *)launchOptions { [self.window addSubview:self.viewController.view]; [self.window makeKeyAndVisible]; return YES; } @end ================================================ FILE: Examples/Advanced iOS Demo/iCarouselExampleViewController.h ================================================ // // iCarouselExampleViewController.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import #import "iCarousel.h" @interface iCarouselExampleViewController : UIViewController @property (nonatomic, strong) IBOutlet iCarousel *carousel; @property (nonatomic, strong) IBOutlet UINavigationItem *navItem; @property (nonatomic, strong) IBOutlet UIBarItem *orientationBarItem; @property (nonatomic, strong) IBOutlet UIBarItem *wrapBarItem; - (IBAction)switchCarouselType; - (IBAction)toggleOrientation; - (IBAction)toggleWrap; - (IBAction)insertItem; - (IBAction)removeItem; @end ================================================ FILE: Examples/Advanced iOS Demo/iCarouselExampleViewController.m ================================================ // // iCarouselExampleViewController.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleViewController.h" #pragma clang diagnostic ignored "-Wgnu" #pragma clang diagnostic ignored "-Wconversion" #pragma clang diagnostic ignored "-Wdouble-promotion" @interface iCarouselExampleViewController () @property (nonatomic, assign) BOOL wrap; @property (nonatomic, strong) NSMutableArray *items; @end @implementation iCarouselExampleViewController @synthesize carousel; @synthesize navItem; @synthesize orientationBarItem; @synthesize wrapBarItem; @synthesize wrap; @synthesize items; - (void)setUp { //set up data self.wrap = YES; self.items = [NSMutableArray array]; for (int i = 0; i < 10; i++) { [self.items addObject:@(i)]; } } - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { [self setUp]; } return self; } - (id)initWithCoder:(NSCoder *)aDecoder { if ((self = [super initWithCoder:aDecoder])) { [self setUp]; } return self; } - (void)dealloc { //it's a good idea to set these to nil here to avoid //sending messages to a deallocated viewcontroller carousel.delegate = nil; carousel.dataSource = nil; } #pragma mark - #pragma mark View lifecycle - (void)viewDidLoad { [super viewDidLoad]; //configure carousel self.carousel.type = iCarouselTypeCoverFlow2; self.navItem.title = @"CoverFlow2"; } - (IBAction)switchCarouselType { UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@"Select Carousel Type" delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:@"Linear", @"Rotary", @"Inverted Rotary", @"Cylinder", @"Inverted Cylinder", @"Wheel", @"Inverted Wheel", @"CoverFlow", @"CoverFlow2", @"Time Machine", @"Inverted Time Machine", @"Custom", nil]; [sheet showInView:self.view]; } - (IBAction)toggleOrientation { //carousel orientation can be animated [UIView beginAnimations:nil context:nil]; self.carousel.vertical = !self.carousel.vertical; [UIView commitAnimations]; //update button self.orientationBarItem.title = self.carousel.vertical? @"Vertical": @"Horizontal"; } - (IBAction)toggleWrap { self.wrap = !self.wrap; self.wrapBarItem.title = self.wrap? @"Wrap: ON": @"Wrap: OFF"; [self.carousel reloadData]; } - (IBAction)insertItem { NSInteger index = MAX(0, self.carousel.currentItemIndex); [self.items insertObject:@(self.carousel.numberOfItems) atIndex:(NSUInteger)index]; [self.carousel insertItemAtIndex:index animated:YES]; } - (IBAction)removeItem { if (self.carousel.numberOfItems > 0) { NSInteger index = self.carousel.currentItemIndex; [self.items removeObjectAtIndex:(NSUInteger)index]; [self.carousel removeItemAtIndex:index animated:YES]; } } #pragma mark - #pragma mark UIActionSheet methods - (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex { if (buttonIndex >= 0) { //map button index to carousel type iCarouselType type = buttonIndex; //carousel can smoothly animate between types [UIView beginAnimations:nil context:nil]; self.carousel.type = type; [UIView commitAnimations]; //update title self.navItem.title = [actionSheet buttonTitleAtIndex:buttonIndex]; } } #pragma mark - #pragma mark iCarousel methods - (NSInteger)numberOfItemsInCarousel:(__unused iCarousel *)carousel { return (NSInteger)[self.items count]; } - (UIView *)carousel:(__unused iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view { UILabel *label = nil; //create new view if no view is available for recycling if (view == nil) { view = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 200.0, 200.0)]; ((UIImageView *)view).image = [UIImage imageNamed:@"page.png"]; view.contentMode = UIViewContentModeCenter; label = [[UILabel alloc] initWithFrame:view.bounds]; label.backgroundColor = [UIColor clearColor]; label.textAlignment = NSTextAlignmentCenter; label.font = [label.font fontWithSize:50]; label.tag = 1; [view addSubview:label]; } else { //get a reference to the label in the recycled view label = (UILabel *)[view viewWithTag:1]; } //set item label //remember to always set any properties of your carousel item //views outside of the `if (view == nil) {...}` check otherwise //you'll get weird issues with carousel item content appearing //in the wrong place in the carousel label.text = [self.items[(NSUInteger)index] stringValue]; return view; } - (NSInteger)numberOfPlaceholdersInCarousel:(__unused iCarousel *)carousel { //note: placeholder views are only displayed on some carousels if wrapping is disabled return 2; } - (UIView *)carousel:(__unused iCarousel *)carousel placeholderViewAtIndex:(NSInteger)index reusingView:(UIView *)view { UILabel *label = nil; //create new view if no view is available for recycling if (view == nil) { //don't do anything specific to the index within //this `if (view == nil) {...}` statement because the view will be //recycled and used with other index values later view = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 200.0, 200.0)]; ((UIImageView *)view).image = [UIImage imageNamed:@"page.png"]; view.contentMode = UIViewContentModeCenter; label = [[UILabel alloc] initWithFrame:view.bounds]; label.backgroundColor = [UIColor clearColor]; label.textAlignment = NSTextAlignmentCenter; label.font = [label.font fontWithSize:50.0]; label.tag = 1; [view addSubview:label]; } else { //get a reference to the label in the recycled view label = (UILabel *)[view viewWithTag:1]; } //set item label //remember to always set any properties of your carousel item //views outside of the `if (view == nil) {...}` check otherwise //you'll get weird issues with carousel item content appearing //in the wrong place in the carousel label.text = (index == 0)? @"[": @"]"; return view; } - (CATransform3D)carousel:(__unused iCarousel *)carousel itemTransformForOffset:(CGFloat)offset baseTransform:(CATransform3D)transform { //implement 'flip3D' style carousel transform = CATransform3DRotate(transform, M_PI / 8.0, 0.0, 1.0, 0.0); return CATransform3DTranslate(transform, 0.0, 0.0, offset * self.carousel.itemWidth); } - (CGFloat)carousel:(__unused iCarousel *)carousel valueForOption:(iCarouselOption)option withDefault:(CGFloat)value { //customize carousel display switch (option) { case iCarouselOptionWrap: { //normally you would hard-code this to YES or NO return self.wrap; } case iCarouselOptionSpacing: { //add a bit of spacing between the item views return value * 1.05; } case iCarouselOptionFadeMax: { if (self.carousel.type == iCarouselTypeCustom) { //set opacity based on distance from camera return 0.0; } return value; } case iCarouselOptionShowBackfaces: case iCarouselOptionRadius: case iCarouselOptionAngle: case iCarouselOptionArc: case iCarouselOptionTilt: case iCarouselOptionCount: case iCarouselOptionFadeMin: case iCarouselOptionFadeMinAlpha: case iCarouselOptionFadeRange: case iCarouselOptionOffsetMultiplier: case iCarouselOptionVisibleItems: { return value; } } } #pragma mark - #pragma mark iCarousel taps - (void)carousel:(__unused iCarousel *)carousel didSelectItemAtIndex:(NSInteger)index { NSNumber *item = (self.items)[(NSUInteger)index]; NSLog(@"Tapped view number: %@", item); } - (void)carouselCurrentItemIndexDidChange:(__unused iCarousel *)carousel { NSLog(@"Index: %@", @(self.carousel.currentItemIndex)); } @end ================================================ FILE: Examples/Advanced iOS Demo/main.m ================================================ // // main.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import int main(int argc, char *argv[]) { @autoreleasepool { int retVal = UIApplicationMain(argc, argv, nil, nil); return retVal; } } ================================================ FILE: Examples/Basic iOS Example/en.lproj/InfoPlist.strings ================================================ /* Localized versions of Info.plist keys */ ================================================ FILE: Examples/Basic iOS Example/en.lproj/MainWindow.xib ================================================ 1552 12C3012 3084 1187.34 625.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin 2083 YES IBProxyObject IBUICustomObject IBUIViewController YES com.apple.InterfaceBuilder.IBCocoaTouchPlugin PluginDependencyRecalculationVersion YES IBFilesOwner IBCocoaTouchFramework IBFirstResponder IBCocoaTouchFramework IBCocoaTouchFramework iCarouselExampleViewController 1 1 IBCocoaTouchFramework NO YES delegate 4 viewController 11 YES 0 YES -1 File's Owner 3 iCarouselExample App Delegate -2 10 YES YES -1.CustomClassName -1.IBPluginDependency -2.CustomClassName -2.IBPluginDependency 10.CustomClassName 10.IBPluginDependency 3.CustomClassName 3.IBPluginDependency YES UIApplication com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIResponder com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarouselExampleViewController com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarouselExampleAppDelegate com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES 16 YES iCarousel UIView YES YES dataSource delegate YES id id YES YES dataSource delegate YES dataSource id delegate id IBProjectSource ./Classes/iCarousel.h iCarouselExampleAppDelegate NSObject YES YES viewController window YES iCarouselExampleViewController UIWindow YES YES viewController window YES viewController iCarouselExampleViewController window UIWindow IBProjectSource ./Classes/iCarouselExampleAppDelegate.h iCarouselExampleViewController UIViewController carousel iCarousel carousel carousel iCarousel IBProjectSource ./Classes/iCarouselExampleViewController.h 0 IBCocoaTouchFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 YES 3 2083 ================================================ FILE: Examples/Basic iOS Example/en.lproj/iCarouselExampleViewController.xib ================================================ 1552 12E55 3084 1187.39 626.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin 2083 YES IBProxyObject IBUIImageView IBUIView YES com.apple.InterfaceBuilder.IBCocoaTouchPlugin PluginDependencyRecalculationVersion YES IBFilesOwner IBCocoaTouchFramework IBFirstResponder IBCocoaTouchFramework 274 YES 274 {320, 468} NO YES YES IBCocoaTouchFramework NSImage background.png 274 {320, 460} 3 MSAwAA 2 IBCocoaTouchFramework {{0, 20}, {320, 460}} 3 MC43NQA NO IBCocoaTouchFramework YES view 7 carousel 9 dataSource 10 delegate 11 YES 0 YES -1 File's Owner -2 6 YES 8 YES iCarousel 21 YES YES -1.CustomClassName -1.IBPluginDependency -2.CustomClassName -2.IBPluginDependency 21.IBPluginDependency 6.IBPluginDependency 8.CustomClassName 8.IBPluginDependency YES iCarouselExampleViewController com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIResponder com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarousel com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES 37 0 IBCocoaTouchFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 YES 3 background.png {50, 468} 2083 ================================================ FILE: Examples/Basic iOS Example/iCarouselExample-Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleDisplayName ${PRODUCT_NAME} CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIconFile CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1.0 LSRequiresIPhoneOS NSMainNibFile MainWindow UIStatusBarHidden UISupportedInterfaceOrientations UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight ================================================ FILE: Examples/Basic iOS Example/iCarouselExample-Prefix.pch ================================================ // // Prefix header for all source files of the 'iCarouselExample' target in the 'iCarouselExample' project // #import #ifndef __IPHONE_3_0 #warning "This project uses features only available in iPhone SDK 3.0 and later." #endif #ifdef __OBJC__ #import #import #endif ================================================ FILE: Examples/Basic iOS Example/iCarouselExample.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 01308D9313491C3500453707 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9213491C3500453707 /* UIKit.framework */; }; 01308D9513491C3500453707 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9413491C3500453707 /* Foundation.framework */; }; 01308D9713491C3500453707 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9613491C3500453707 /* CoreGraphics.framework */; }; 01308DC013491F7200453707 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308DBF13491F7200453707 /* QuartzCore.framework */; }; 013F5C60168A59F500355CAD /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 013F5C5F168A59F500355CAD /* Default-568h@2x.png */; }; 0148358813A36C2000E687AC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358313A36C2000E687AC /* main.m */; }; 0148359313A36C3700E687AC /* iCarouselExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */; }; 0148359413A36C3700E687AC /* iCarouselExampleAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */; }; 0148359513A36C3700E687AC /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0148358F13A36C3700E687AC /* MainWindow.xib */; }; 0148359613A36C3700E687AC /* iCarouselExampleViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */; }; B2E5E6C1146145C900EADB7A /* iCarousel.m in Sources */ = {isa = PBXBuildFile; fileRef = B2E5E6C0146145C900EADB7A /* iCarousel.m */; }; B2E5E72D1461544B00EADB7A /* background.png in Resources */ = {isa = PBXBuildFile; fileRef = B2E5E72B1461544B00EADB7A /* background.png */; }; B2E5E72E1461544B00EADB7A /* page.png in Resources */ = {isa = PBXBuildFile; fileRef = B2E5E72C1461544B00EADB7A /* page.png */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 01308D9213491C3500453707 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 01308D9413491C3500453707 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 01308D9613491C3500453707 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 01308DBF13491F7200453707 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 013F5C5F168A59F500355CAD /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = SOURCE_ROOT; }; 0148358313A36C2000E687AC /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = SOURCE_ROOT; }; 0148358413A36C2000E687AC /* iCarouselExample-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "iCarouselExample-Info.plist"; sourceTree = SOURCE_ROOT; }; 0148358513A36C2000E687AC /* iCarouselExample-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "iCarouselExample-Prefix.pch"; sourceTree = SOURCE_ROOT; }; 0148358713A36C2000E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = SOURCE_ROOT; }; 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleViewController.m; sourceTree = SOURCE_ROOT; }; 0148358C13A36C3700E687AC /* iCarouselExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleViewController.h; sourceTree = SOURCE_ROOT; }; 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleAppDelegate.m; sourceTree = SOURCE_ROOT; }; 0148358E13A36C3700E687AC /* iCarouselExampleAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleAppDelegate.h; sourceTree = SOURCE_ROOT; }; 0148359013A36C3700E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainWindow.xib; sourceTree = SOURCE_ROOT; }; 0148359213A36C3700E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/iCarouselExampleViewController.xib; sourceTree = SOURCE_ROOT; }; 018BBCB413A375AF005CA505 /* iCarouselExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iCarouselExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; B2E5E6BF146145C900EADB7A /* iCarousel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarousel.h; sourceTree = ""; }; B2E5E6C0146145C900EADB7A /* iCarousel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarousel.m; sourceTree = ""; }; B2E5E72B1461544B00EADB7A /* background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = background.png; path = ../Resources/background.png; sourceTree = SOURCE_ROOT; }; B2E5E72C1461544B00EADB7A /* page.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = page.png; path = ../Resources/page.png; sourceTree = SOURCE_ROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 01308D8B13491C3500453707 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 01308DC013491F7200453707 /* QuartzCore.framework in Frameworks */, 01308D9313491C3500453707 /* UIKit.framework in Frameworks */, 01308D9513491C3500453707 /* Foundation.framework in Frameworks */, 01308D9713491C3500453707 /* CoreGraphics.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 01308D8313491C3500453707 = { isa = PBXGroup; children = ( B2E5E6BE146145C900EADB7A /* iCarousel */, 01308D9813491C3500453707 /* iCarouselExample */, 01308D9113491C3500453707 /* Frameworks */, 01308D8F13491C3500453707 /* Products */, ); sourceTree = ""; }; 01308D8F13491C3500453707 /* Products */ = { isa = PBXGroup; children = ( 018BBCB413A375AF005CA505 /* iCarouselExample.app */, ); name = Products; sourceTree = ""; }; 01308D9113491C3500453707 /* Frameworks */ = { isa = PBXGroup; children = ( 01308DBF13491F7200453707 /* QuartzCore.framework */, 01308D9213491C3500453707 /* UIKit.framework */, 01308D9413491C3500453707 /* Foundation.framework */, 01308D9613491C3500453707 /* CoreGraphics.framework */, ); name = Frameworks; sourceTree = ""; }; 01308D9813491C3500453707 /* iCarouselExample */ = { isa = PBXGroup; children = ( 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */, 0148358C13A36C3700E687AC /* iCarouselExampleViewController.h */, 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */, 0148358E13A36C3700E687AC /* iCarouselExampleAppDelegate.h */, 0148358F13A36C3700E687AC /* MainWindow.xib */, 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */, B2E5E72A1461543E00EADB7A /* Resources */, 01308D9913491C3500453707 /* Supporting Files */, ); path = iCarouselExample; sourceTree = ""; }; 01308D9913491C3500453707 /* Supporting Files */ = { isa = PBXGroup; children = ( 013F5C5F168A59F500355CAD /* Default-568h@2x.png */, 0148358313A36C2000E687AC /* main.m */, 0148358413A36C2000E687AC /* iCarouselExample-Info.plist */, 0148358513A36C2000E687AC /* iCarouselExample-Prefix.pch */, 0148358613A36C2000E687AC /* InfoPlist.strings */, ); name = "Supporting Files"; sourceTree = ""; }; B2E5E6BE146145C900EADB7A /* iCarousel */ = { isa = PBXGroup; children = ( B2E5E6BF146145C900EADB7A /* iCarousel.h */, B2E5E6C0146145C900EADB7A /* iCarousel.m */, ); name = iCarousel; path = ../../iCarousel; sourceTree = ""; }; B2E5E72A1461543E00EADB7A /* Resources */ = { isa = PBXGroup; children = ( B2E5E72B1461544B00EADB7A /* background.png */, B2E5E72C1461544B00EADB7A /* page.png */, ); name = Resources; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 01308D8D13491C3500453707 /* iCarouselExample */ = { isa = PBXNativeTarget; buildConfigurationList = 01308DAF13491C3500453707 /* Build configuration list for PBXNativeTarget "iCarouselExample" */; buildPhases = ( 01308D8A13491C3500453707 /* Sources */, 01308D8B13491C3500453707 /* Frameworks */, 01308D8C13491C3500453707 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = iCarouselExample; productName = iCarouselExample; productReference = 018BBCB413A375AF005CA505 /* iCarouselExample.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 01308D8513491C3500453707 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0800; }; buildConfigurationList = 01308D8813491C3500453707 /* Build configuration list for PBXProject "iCarouselExample" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); mainGroup = 01308D8313491C3500453707; productRefGroup = 01308D8F13491C3500453707 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 01308D8D13491C3500453707 /* iCarouselExample */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 01308D8C13491C3500453707 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 0148359513A36C3700E687AC /* MainWindow.xib in Resources */, 0148359613A36C3700E687AC /* iCarouselExampleViewController.xib in Resources */, B2E5E72D1461544B00EADB7A /* background.png in Resources */, B2E5E72E1461544B00EADB7A /* page.png in Resources */, 013F5C60168A59F500355CAD /* Default-568h@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 01308D8A13491C3500453707 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 0148358813A36C2000E687AC /* main.m in Sources */, 0148359313A36C3700E687AC /* iCarouselExampleViewController.m in Sources */, 0148359413A36C3700E687AC /* iCarouselExampleAppDelegate.m in Sources */, B2E5E6C1146145C900EADB7A /* iCarousel.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 0148358613A36C2000E687AC /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( 0148358713A36C2000E687AC /* en */, ); name = InfoPlist.strings; sourceTree = ""; }; 0148358F13A36C3700E687AC /* MainWindow.xib */ = { isa = PBXVariantGroup; children = ( 0148359013A36C3700E687AC /* en */, ); name = MainWindow.xib; sourceTree = ""; }; 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */ = { isa = PBXVariantGroup; children = ( 0148359213A36C3700E687AC /* en */, ); name = iCarouselExampleViewController.xib; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 01308DAD13491C3500453707 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = DEBUG; GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_TREAT_WARNINGS_AS_ERRORS = YES; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; ONLY_ACTIVE_ARCH = YES; RUN_CLANG_STATIC_ANALYZER = YES; SDKROOT = iphoneos; }; name = Debug; }; 01308DAE13491C3500453707 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_TREAT_WARNINGS_AS_ERRORS = YES; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; RUN_CLANG_STATIC_ANALYZER = YES; SDKROOT = iphoneos; }; name = Release; }; 01308DB013491C3500453707 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselExample-Prefix.pch"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = ""; INFOPLIST_FILE = "iCarouselExample-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = iCarouselExample; TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = app; }; name = Debug; }; 01308DB113491C3500453707 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselExample-Prefix.pch"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = ""; INFOPLIST_FILE = "iCarouselExample-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = iCarouselExample; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; WRAPPER_EXTENSION = app; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 01308D8813491C3500453707 /* Build configuration list for PBXProject "iCarouselExample" */ = { isa = XCConfigurationList; buildConfigurations = ( 01308DAD13491C3500453707 /* Debug */, 01308DAE13491C3500453707 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 01308DAF13491C3500453707 /* Build configuration list for PBXNativeTarget "iCarouselExample" */ = { isa = XCConfigurationList; buildConfigurations = ( 01308DB013491C3500453707 /* Debug */, 01308DB113491C3500453707 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 01308D8513491C3500453707 /* Project object */; } ================================================ FILE: Examples/Basic iOS Example/iCarouselExampleAppDelegate.h ================================================ // // iCarouselExampleAppDelegate.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import @class iCarouselExampleViewController; @interface iCarouselExampleAppDelegate : NSObject @property (nonatomic, strong) IBOutlet UIWindow *window; @property (nonatomic, strong) IBOutlet iCarouselExampleViewController *viewController; @end ================================================ FILE: Examples/Basic iOS Example/iCarouselExampleAppDelegate.m ================================================ // // iCarouselExampleAppDelegate.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleAppDelegate.h" #import "iCarouselExampleViewController.h" @implementation iCarouselExampleAppDelegate @synthesize window; @synthesize viewController; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; window.rootViewController = viewController; [window makeKeyAndVisible]; return YES; } @end ================================================ FILE: Examples/Basic iOS Example/iCarouselExampleViewController.h ================================================ // // iCarouselExampleViewController.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import #import "iCarousel.h" @interface iCarouselExampleViewController : UIViewController @property (nonatomic, strong) IBOutlet iCarousel *carousel; @end ================================================ FILE: Examples/Basic iOS Example/iCarouselExampleViewController.m ================================================ // // iCarouselExampleViewController.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleViewController.h" @interface iCarouselExampleViewController () @property (nonatomic, strong) NSMutableArray *items; @end @implementation iCarouselExampleViewController - (void)awakeFromNib { [super awakeFromNib]; //set up data //your carousel should always be driven by an array of //data of some kind - don't store data in your item views //or the recycling mechanism will destroy your data once //your item views move off-screen self.items = [NSMutableArray array]; for (int i = 0; i < 100; i++) { [_items addObject:@(i)]; } } - (void)dealloc { //it's a good idea to set these to nil here to avoid //sending messages to a deallocated viewcontroller //this is true even if your project is using ARC, unless //you are targeting iOS 5 as a minimum deployment target _carousel.delegate = nil; _carousel.dataSource = nil; } #pragma mark - #pragma mark View lifecycle - (void)viewDidLoad { [super viewDidLoad]; //configure carousel _carousel.type = iCarouselTypeCoverFlow2; } - (void)viewDidUnload { [super viewDidUnload]; //free up memory by releasing subviews self.carousel = nil; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } #pragma mark - #pragma mark iCarousel methods - (NSInteger)numberOfItemsInCarousel:(iCarousel *)carousel { //return the total number of items in the carousel return [_items count]; } - (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view { UILabel *label = nil; //create new view if no view is available for recycling if (view == nil) { //don't do anything specific to the index within //this `if (view == nil) {...}` statement because the view will be //recycled and used with other index values later view = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 200.0f, 200.0f)]; ((UIImageView *)view).image = [UIImage imageNamed:@"page.png"]; view.contentMode = UIViewContentModeCenter; label = [[UILabel alloc] initWithFrame:view.bounds]; label.backgroundColor = [UIColor clearColor]; label.textAlignment = NSTextAlignmentCenter; label.font = [label.font fontWithSize:50]; label.tag = 1; [view addSubview:label]; } else { //get a reference to the label in the recycled view label = (UILabel *)[view viewWithTag:1]; } //set item label //remember to always set any properties of your carousel item //views outside of the `if (view == nil) {...}` check otherwise //you'll get weird issues with carousel item content appearing //in the wrong place in the carousel label.text = [_items[index] stringValue]; return view; } - (CGFloat)carousel:(iCarousel *)carousel valueForOption:(iCarouselOption)option withDefault:(CGFloat)value { if (option == iCarouselOptionSpacing) { return value * 1.1; } return value; } @end ================================================ FILE: Examples/Basic iOS Example/main.m ================================================ // // main.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import int main(int argc, char *argv[]) { @autoreleasepool { int retVal = UIApplicationMain(argc, argv, nil, nil); return retVal; } } ================================================ FILE: Examples/Buttons Demo/en.lproj/InfoPlist.strings ================================================ /* Localized versions of Info.plist keys */ ================================================ FILE: Examples/Buttons Demo/en.lproj/MainWindow.xib ================================================ 1552 12E55 3084 1187.39 626.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin 2083 YES IBProxyObject IBUICustomObject IBUIViewController IBUIWindow YES com.apple.InterfaceBuilder.IBCocoaTouchPlugin PluginDependencyRecalculationVersion YES IBFilesOwner IBCocoaTouchFramework IBFirstResponder IBCocoaTouchFramework IBCocoaTouchFramework iCarouselExampleViewController 1 1 IBCocoaTouchFramework NO 292 {320, 480} 1 MSAxIDEAA NO NO IBCocoaTouchFramework YES YES delegate 4 viewController 11 window 14 rootViewController 16 YES 0 YES -1 File's Owner 3 iCarouselExample App Delegate -2 10 12 YES YES -1.CustomClassName -1.IBPluginDependency -2.CustomClassName -2.IBPluginDependency 10.CustomClassName 10.IBPluginDependency 12.IBPluginDependency 3.CustomClassName 3.IBPluginDependency YES UIApplication com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIResponder com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarouselExampleViewController com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarouselExampleAppDelegate com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES 16 YES iCarousel UIView YES YES dataSource delegate YES id id YES YES dataSource delegate YES dataSource id delegate id IBProjectSource ./Classes/iCarousel.h iCarouselExampleAppDelegate NSObject YES YES viewController window YES iCarouselExampleViewController UIWindow YES YES viewController window YES viewController iCarouselExampleViewController window UIWindow IBProjectSource ./Classes/iCarouselExampleAppDelegate.h iCarouselExampleViewController UIViewController carousel iCarousel carousel carousel iCarousel IBProjectSource ./Classes/iCarouselExampleViewController.h 0 IBCocoaTouchFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 YES 3 2083 ================================================ FILE: Examples/Buttons Demo/en.lproj/iCarouselExampleViewController.xib ================================================ 1280 10K549 1938 1038.36 461.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin 933 YES IBProxyObject IBUIView IBUIImageView YES com.apple.InterfaceBuilder.IBCocoaTouchPlugin PluginDependencyRecalculationVersion YES IBFilesOwner IBCocoaTouchFramework IBFirstResponder IBCocoaTouchFramework 274 YES 274 {320, 480} NO YES YES IBCocoaTouchFramework NSImage background.png 274 {320, 480} 3 MSAwAA 2 IBCocoaTouchFramework {320, 480} 3 MQA NO IBCocoaTouchFramework YES view 7 carousel 9 dataSource 10 delegate 11 YES 0 YES -1 File's Owner -2 6 YES 8 YES iCarousel 35 YES YES -1.CustomClassName -1.IBPluginDependency -2.CustomClassName -2.IBPluginDependency 35.IBPluginDependency 6.IBPluginDependency 8.CustomClassName 8.IBPluginDependency YES iCarouselExampleViewController com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIResponder com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarousel com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES 35 YES iCarousel UIView YES YES dataSource delegate YES id id YES YES dataSource delegate YES dataSource id delegate id IBProjectSource ./Classes/iCarousel.h iCarouselExampleViewController UIViewController carousel iCarousel carousel carousel iCarousel IBProjectSource ./Classes/iCarouselExampleViewController.h 0 IBCocoaTouchFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 YES 3 background.png {50, 468} 933 ================================================ FILE: Examples/Buttons Demo/iCarouselButtonsDemo-Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleDisplayName ${PRODUCT_NAME} CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIconFile CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1.0 LSRequiresIPhoneOS NSMainNibFile MainWindow UIStatusBarHidden UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight ================================================ FILE: Examples/Buttons Demo/iCarouselButtonsDemo-Prefix.pch ================================================ // // Prefix header for all source files of the 'iCarouselExample' target in the 'iCarouselExample' project // #import #ifndef __IPHONE_3_0 #warning "This project uses features only available in iPhone SDK 3.0 and later." #endif #ifdef __OBJC__ #import #import #endif ================================================ FILE: Examples/Buttons Demo/iCarouselButtonsDemo.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 01308D9313491C3500453707 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9213491C3500453707 /* UIKit.framework */; }; 01308D9513491C3500453707 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9413491C3500453707 /* Foundation.framework */; }; 01308D9713491C3500453707 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9613491C3500453707 /* CoreGraphics.framework */; }; 01308DC013491F7200453707 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308DBF13491F7200453707 /* QuartzCore.framework */; }; 0148358813A36C2000E687AC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358313A36C2000E687AC /* main.m */; }; 0148359313A36C3700E687AC /* iCarouselExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */; }; 0148359413A36C3700E687AC /* iCarouselExampleAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */; }; 0148359513A36C3700E687AC /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0148358F13A36C3700E687AC /* MainWindow.xib */; }; 0148359613A36C3700E687AC /* iCarouselExampleViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */; }; 018AE98C179D7F6A00FB7311 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 018AE98B179D7F6A00FB7311 /* Default-568h@2x.png */; }; B29BD7B814A3476C00BB4E68 /* background.png in Resources */ = {isa = PBXBuildFile; fileRef = B29BD7B614A3476C00BB4E68 /* background.png */; }; B29BD7B914A3476C00BB4E68 /* page.png in Resources */ = {isa = PBXBuildFile; fileRef = B29BD7B714A3476C00BB4E68 /* page.png */; }; B2E5E749146155E300EADB7A /* iCarousel.m in Sources */ = {isa = PBXBuildFile; fileRef = B2E5E748146155E300EADB7A /* iCarousel.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 01308D9213491C3500453707 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 01308D9413491C3500453707 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 01308D9613491C3500453707 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 01308DBF13491F7200453707 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 0148358313A36C2000E687AC /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = SOURCE_ROOT; }; 0148358413A36C2000E687AC /* iCarouselButtonsDemo-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "iCarouselButtonsDemo-Prefix.pch"; sourceTree = SOURCE_ROOT; }; 0148358513A36C2000E687AC /* iCarouselButtonsDemo-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "iCarouselButtonsDemo-Info.plist"; sourceTree = SOURCE_ROOT; }; 0148358713A36C2000E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = SOURCE_ROOT; }; 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleViewController.m; sourceTree = SOURCE_ROOT; }; 0148358C13A36C3700E687AC /* iCarouselExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleViewController.h; sourceTree = SOURCE_ROOT; }; 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleAppDelegate.m; sourceTree = SOURCE_ROOT; }; 0148358E13A36C3700E687AC /* iCarouselExampleAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleAppDelegate.h; sourceTree = SOURCE_ROOT; }; 0148359013A36C3700E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainWindow.xib; sourceTree = SOURCE_ROOT; }; 0148359213A36C3700E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/iCarouselExampleViewController.xib; sourceTree = SOURCE_ROOT; }; 018AE98B179D7F6A00FB7311 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = SOURCE_ROOT; }; 018BBCB413A375AF005CA505 /* iCarouselButtonsDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iCarouselButtonsDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; B29BD7B614A3476C00BB4E68 /* background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = background.png; sourceTree = ""; }; B29BD7B714A3476C00BB4E68 /* page.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = page.png; sourceTree = ""; }; B2E5E747146155E300EADB7A /* iCarousel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarousel.h; sourceTree = ""; }; B2E5E748146155E300EADB7A /* iCarousel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarousel.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 01308D8B13491C3500453707 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 01308DC013491F7200453707 /* QuartzCore.framework in Frameworks */, 01308D9313491C3500453707 /* UIKit.framework in Frameworks */, 01308D9513491C3500453707 /* Foundation.framework in Frameworks */, 01308D9713491C3500453707 /* CoreGraphics.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 01308D8313491C3500453707 = { isa = PBXGroup; children = ( B2E5E746146155E300EADB7A /* iCarousel */, 01308D9813491C3500453707 /* iCarouselExample */, B29BD7B514A3476C00BB4E68 /* Resources */, 01308D9113491C3500453707 /* Frameworks */, 01308D8F13491C3500453707 /* Products */, ); sourceTree = ""; }; 01308D8F13491C3500453707 /* Products */ = { isa = PBXGroup; children = ( 018BBCB413A375AF005CA505 /* iCarouselButtonsDemo.app */, ); name = Products; sourceTree = ""; }; 01308D9113491C3500453707 /* Frameworks */ = { isa = PBXGroup; children = ( 01308DBF13491F7200453707 /* QuartzCore.framework */, 01308D9213491C3500453707 /* UIKit.framework */, 01308D9413491C3500453707 /* Foundation.framework */, 01308D9613491C3500453707 /* CoreGraphics.framework */, ); name = Frameworks; sourceTree = ""; }; 01308D9813491C3500453707 /* iCarouselExample */ = { isa = PBXGroup; children = ( 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */, 0148358C13A36C3700E687AC /* iCarouselExampleViewController.h */, 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */, 0148358E13A36C3700E687AC /* iCarouselExampleAppDelegate.h */, 0148358F13A36C3700E687AC /* MainWindow.xib */, 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */, 01308D9913491C3500453707 /* Supporting Files */, ); path = iCarouselExample; sourceTree = ""; }; 01308D9913491C3500453707 /* Supporting Files */ = { isa = PBXGroup; children = ( 018AE98B179D7F6A00FB7311 /* Default-568h@2x.png */, 0148358313A36C2000E687AC /* main.m */, 0148358413A36C2000E687AC /* iCarouselButtonsDemo-Prefix.pch */, 0148358513A36C2000E687AC /* iCarouselButtonsDemo-Info.plist */, 0148358613A36C2000E687AC /* InfoPlist.strings */, ); name = "Supporting Files"; sourceTree = ""; }; B29BD7B514A3476C00BB4E68 /* Resources */ = { isa = PBXGroup; children = ( B29BD7B614A3476C00BB4E68 /* background.png */, B29BD7B714A3476C00BB4E68 /* page.png */, ); name = Resources; path = ../Resources; sourceTree = ""; }; B2E5E746146155E300EADB7A /* iCarousel */ = { isa = PBXGroup; children = ( B2E5E747146155E300EADB7A /* iCarousel.h */, B2E5E748146155E300EADB7A /* iCarousel.m */, ); name = iCarousel; path = ../../iCarousel; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 01308D8D13491C3500453707 /* iCarouselButtonsDemo */ = { isa = PBXNativeTarget; buildConfigurationList = 01308DAF13491C3500453707 /* Build configuration list for PBXNativeTarget "iCarouselButtonsDemo" */; buildPhases = ( 01308D8A13491C3500453707 /* Sources */, 01308D8B13491C3500453707 /* Frameworks */, 01308D8C13491C3500453707 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = iCarouselButtonsDemo; productName = iCarouselExample; productReference = 018BBCB413A375AF005CA505 /* iCarouselButtonsDemo.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 01308D8513491C3500453707 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0800; }; buildConfigurationList = 01308D8813491C3500453707 /* Build configuration list for PBXProject "iCarouselButtonsDemo" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); mainGroup = 01308D8313491C3500453707; productRefGroup = 01308D8F13491C3500453707 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 01308D8D13491C3500453707 /* iCarouselButtonsDemo */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 01308D8C13491C3500453707 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 0148359513A36C3700E687AC /* MainWindow.xib in Resources */, 0148359613A36C3700E687AC /* iCarouselExampleViewController.xib in Resources */, B29BD7B814A3476C00BB4E68 /* background.png in Resources */, B29BD7B914A3476C00BB4E68 /* page.png in Resources */, 018AE98C179D7F6A00FB7311 /* Default-568h@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 01308D8A13491C3500453707 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 0148358813A36C2000E687AC /* main.m in Sources */, 0148359313A36C3700E687AC /* iCarouselExampleViewController.m in Sources */, 0148359413A36C3700E687AC /* iCarouselExampleAppDelegate.m in Sources */, B2E5E749146155E300EADB7A /* iCarousel.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 0148358613A36C2000E687AC /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( 0148358713A36C2000E687AC /* en */, ); name = InfoPlist.strings; sourceTree = ""; }; 0148358F13A36C3700E687AC /* MainWindow.xib */ = { isa = PBXVariantGroup; children = ( 0148359013A36C3700E687AC /* en */, ); name = MainWindow.xib; sourceTree = ""; }; 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */ = { isa = PBXVariantGroup; children = ( 0148359213A36C3700E687AC /* en */, ); name = iCarouselExampleViewController.xib; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 01308DAD13491C3500453707 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = DEBUG; GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; }; name = Debug; }; 01308DAE13491C3500453707 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; SDKROOT = iphoneos; }; name = Release; }; 01308DB013491C3500453707 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselButtonsDemo-Prefix.pch"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = "iCarouselButtonsDemo-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = iCarouselButtonsDemo; TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = app; }; name = Debug; }; 01308DB113491C3500453707 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselButtonsDemo-Prefix.pch"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = "iCarouselButtonsDemo-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = iCarouselButtonsDemo; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; WRAPPER_EXTENSION = app; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 01308D8813491C3500453707 /* Build configuration list for PBXProject "iCarouselButtonsDemo" */ = { isa = XCConfigurationList; buildConfigurations = ( 01308DAD13491C3500453707 /* Debug */, 01308DAE13491C3500453707 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 01308DAF13491C3500453707 /* Build configuration list for PBXNativeTarget "iCarouselButtonsDemo" */ = { isa = XCConfigurationList; buildConfigurations = ( 01308DB013491C3500453707 /* Debug */, 01308DB113491C3500453707 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 01308D8513491C3500453707 /* Project object */; } ================================================ FILE: Examples/Buttons Demo/iCarouselExampleAppDelegate.h ================================================ // // iCarouselExampleAppDelegate.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import @class iCarouselExampleViewController; @interface iCarouselExampleAppDelegate : NSObject @property (nonatomic, strong) IBOutlet UIWindow *window; @property (nonatomic, strong) IBOutlet iCarouselExampleViewController *viewController; @end ================================================ FILE: Examples/Buttons Demo/iCarouselExampleAppDelegate.m ================================================ // // iCarouselExampleAppDelegate.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleAppDelegate.h" #import "iCarouselExampleViewController.h" @implementation iCarouselExampleAppDelegate @synthesize window; @synthesize viewController; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [window addSubview:viewController.view]; [window makeKeyAndVisible]; return YES; } @end ================================================ FILE: Examples/Buttons Demo/iCarouselExampleViewController.h ================================================ // // iCarouselExampleViewController.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import #import "iCarousel.h" @interface iCarouselExampleViewController : UIViewController @property (nonatomic, strong) IBOutlet iCarousel *carousel; @end ================================================ FILE: Examples/Buttons Demo/iCarouselExampleViewController.m ================================================ // // iCarouselExampleViewController.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleViewController.h" @implementation iCarouselExampleViewController @synthesize carousel; - (void)dealloc { carousel.delegate = nil; carousel.dataSource = nil; } #pragma mark - #pragma mark View lifecycle - (void)viewDidLoad { [super viewDidLoad]; //configure carousel carousel.type = iCarouselTypeCoverFlow2; } - (void)viewDidUnload { [super viewDidUnload]; self.carousel = nil; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } #pragma mark - #pragma mark iCarousel methods - (NSInteger)numberOfItemsInCarousel:(iCarousel *)carousel { //generate 100 buttons //normally we'd use a backing array //as shown in the basic iOS example //but for this example we haven't bothered return 100; } - (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view { UIButton *button = (UIButton *)view; if (button == nil) { //no button available to recycle, so create new one UIImage *image = [UIImage imageNamed:@"page.png"]; button = [UIButton buttonWithType:UIButtonTypeCustom]; button.frame = CGRectMake(0.0f, 0.0f, image.size.width, image.size.height); [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; [button setBackgroundImage:image forState:UIControlStateNormal]; button.titleLabel.font = [button.titleLabel.font fontWithSize:50]; [button addTarget:self action:@selector(buttonTapped:) forControlEvents:UIControlEventTouchUpInside]; } //set button label [button setTitle:[NSString stringWithFormat:@"%zd", index] forState:UIControlStateNormal]; return button; } #pragma mark - #pragma mark Button tap event - (void)buttonTapped:(UIButton *)sender { //get item index for button NSInteger index = [carousel indexOfItemViewOrSubview:sender]; [[[UIAlertView alloc] initWithTitle:@"Button Tapped" message:[NSString stringWithFormat:@"You tapped button number %zd", index] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] show]; } @end ================================================ FILE: Examples/Buttons Demo/main.m ================================================ // // main.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import int main(int argc, char *argv[]) { @autoreleasepool { int retVal = UIApplicationMain(argc, argv, nil, nil); return retVal; } } ================================================ FILE: Examples/Chameleon Demo/Chameleon/.gitignore ================================================ build xcuserdata *.perspectivev3 *.pbxuser *.DS_Store .svn *.xcuserstate *.xcsettings ================================================ FILE: Examples/Chameleon Demo/Chameleon/AVFoundation/AVFoundation.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 14C25EC21211EBC600622309 /* AVAudioSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 14C25EC01211EBC600622309 /* AVAudioSession.h */; settings = {ATTRIBUTES = (Public, ); }; }; 14C25EC31211EBC600622309 /* AVAudioSession.m in Sources */ = {isa = PBXBuildFile; fileRef = 14C25EC11211EBC600622309 /* AVAudioSession.m */; }; 14EFB1A11211DADE00D19B0C /* AVAudioPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 14EFB19F1211DADE00D19B0C /* AVAudioPlayer.h */; settings = {ATTRIBUTES = (Public, ); }; }; 14EFB1A21211DADE00D19B0C /* AVAudioPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 14EFB1A01211DADE00D19B0C /* AVAudioPlayer.m */; }; 14EFB1A81211DB0B00D19B0C /* AVFoundation.h in Headers */ = {isa = PBXBuildFile; fileRef = 14EFB1A71211DB0B00D19B0C /* AVFoundation.h */; settings = {ATTRIBUTES = (Public, ); }; }; 14EFB1BB1211DB5300D19B0C /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 14EFB1BA1211DB5300D19B0C /* Cocoa.framework */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 0867D69BFE84028FC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 0867D6A5FE840307C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 146B1C8C1211D9DA002D85C3 /* AVFoundation_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AVFoundation_Prefix.pch; sourceTree = ""; }; 14C25EC01211EBC600622309 /* AVAudioSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AVAudioSession.h; path = Classes/AVAudioSession.h; sourceTree = ""; }; 14C25EC11211EBC600622309 /* AVAudioSession.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AVAudioSession.m; path = Classes/AVAudioSession.m; sourceTree = ""; }; 14EFB19F1211DADE00D19B0C /* AVAudioPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AVAudioPlayer.h; path = Classes/AVAudioPlayer.h; sourceTree = ""; }; 14EFB1A01211DADE00D19B0C /* AVAudioPlayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AVAudioPlayer.m; path = Classes/AVAudioPlayer.m; sourceTree = ""; }; 14EFB1A71211DB0B00D19B0C /* AVFoundation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AVFoundation.h; path = Classes/AVFoundation.h; sourceTree = ""; }; 14EFB1BA1211DB5300D19B0C /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; 8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 8DC2EF5B0486A6940098B216 /* AVFoundation.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AVFoundation.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 8DC2EF560486A6940098B216 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 14EFB1BB1211DB5300D19B0C /* Cocoa.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 034768DFFF38A50411DB9C8B /* Products */ = { isa = PBXGroup; children = ( 8DC2EF5B0486A6940098B216 /* AVFoundation.framework */, ); name = Products; sourceTree = ""; }; 0867D691FE84028FC02AAC07 /* UIKit */ = { isa = PBXGroup; children = ( 08FB77AEFE84172EC02AAC07 /* Classes */, 089C1665FE841158C02AAC07 /* Resources */, 32C88DFF0371C24200C91783 /* Other Sources */, 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */, 034768DFFF38A50411DB9C8B /* Products */, ); name = UIKit; sourceTree = ""; }; 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = { isa = PBXGroup; children = ( 0867D6A5FE840307C02AAC07 /* AppKit.framework */, 0867D69BFE84028FC02AAC07 /* Foundation.framework */, 14EFB1BA1211DB5300D19B0C /* Cocoa.framework */, ); name = "External Frameworks and Libraries"; sourceTree = ""; }; 089C1665FE841158C02AAC07 /* Resources */ = { isa = PBXGroup; children = ( 8DC2EF5A0486A6940098B216 /* Info.plist */, ); name = Resources; sourceTree = ""; }; 08FB77AEFE84172EC02AAC07 /* Classes */ = { isa = PBXGroup; children = ( 14EFB19F1211DADE00D19B0C /* AVAudioPlayer.h */, 14EFB1A01211DADE00D19B0C /* AVAudioPlayer.m */, 14EFB1A71211DB0B00D19B0C /* AVFoundation.h */, 14C25EC01211EBC600622309 /* AVAudioSession.h */, 14C25EC11211EBC600622309 /* AVAudioSession.m */, ); name = Classes; sourceTree = ""; }; 32C88DFF0371C24200C91783 /* Other Sources */ = { isa = PBXGroup; children = ( 146B1C8C1211D9DA002D85C3 /* AVFoundation_Prefix.pch */, ); name = "Other Sources"; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ 8DC2EF500486A6940098B216 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( 14EFB1A11211DADE00D19B0C /* AVAudioPlayer.h in Headers */, 14EFB1A81211DB0B00D19B0C /* AVFoundation.h in Headers */, 14C25EC21211EBC600622309 /* AVAudioSession.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ 8DC2EF4F0486A6940098B216 /* AVFoundation */ = { isa = PBXNativeTarget; buildConfigurationList = 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "AVFoundation" */; buildPhases = ( 8DC2EF500486A6940098B216 /* Headers */, 8DC2EF520486A6940098B216 /* Resources */, 8DC2EF540486A6940098B216 /* Sources */, 8DC2EF560486A6940098B216 /* Frameworks */, ); buildRules = ( ); dependencies = ( ); name = AVFoundation; productInstallPath = "$(HOME)/Library/Frameworks"; productName = UIKit; productReference = 8DC2EF5B0486A6940098B216 /* AVFoundation.framework */; productType = "com.apple.product-type.framework"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 0867D690FE84028FC02AAC07 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0510; }; buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "AVFoundation" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( English, Japanese, French, German, ); mainGroup = 0867D691FE84028FC02AAC07 /* UIKit */; productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 8DC2EF4F0486A6940098B216 /* AVFoundation */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 8DC2EF520486A6940098B216 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 8DC2EF540486A6940098B216 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 14EFB1A21211DADE00D19B0C /* AVAudioPlayer.m in Sources */, 14C25EC31211EBC600622309 /* AVAudioSession.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin XCBuildConfiguration section */ 1DEB91AE08733DA50010E9CD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; GCC_DYNAMIC_NO_PIC = NO; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = AVFoundation_Prefix.pch; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; PRODUCT_NAME = AVFoundation; SYMROOT = ../build; WRAPPER_EXTENSION = framework; }; name = Debug; }; 1DEB91AF08733DA50010E9CD /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = AVFoundation_Prefix.pch; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; PRODUCT_NAME = AVFoundation; SYMROOT = ../build; WRAPPER_EXTENSION = framework; }; name = Release; }; 1DEB91B208733DA50010E9CD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.7; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; }; name = Debug; }; 1DEB91B308733DA50010E9CD /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = "3rd Party Mac Developer Application"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.7; PROVISIONING_PROFILE = ""; SDKROOT = macosx; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "AVFoundation" */ = { isa = XCConfigurationList; buildConfigurations = ( 1DEB91AE08733DA50010E9CD /* Debug */, 1DEB91AF08733DA50010E9CD /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "AVFoundation" */ = { isa = XCConfigurationList; buildConfigurations = ( 1DEB91B208733DA50010E9CD /* Debug */, 1DEB91B308733DA50010E9CD /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 0867D690FE84028FC02AAC07 /* Project object */; } ================================================ FILE: Examples/Chameleon Demo/Chameleon/AVFoundation/AVFoundation.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: Examples/Chameleon Demo/Chameleon/AVFoundation/AVFoundation_Prefix.pch ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifdef __OBJC__ #import #endif ================================================ FILE: Examples/Chameleon Demo/Chameleon/AVFoundation/Classes/AVAudioPlayer.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @class AVAudioPlayer; @protocol AVAudioPlayerDelegate @optional - (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag; - (void)audioPlayerDecodeErrorDidOccur:(AVAudioPlayer *)player error:(NSError *)error; - (void)audioPlayerBeginInterruption:(AVAudioPlayer *)player; - (void)audioPlayerEndInterruption:(AVAudioPlayer *)player; @end @interface AVAudioPlayer : NSObject { @private id _player; id _delegate; NSInteger _numberOfLoops; NSInteger _currentLoop; NSURL *_url; NSData *_data; BOOL _isPaused; } - (id)initWithContentsOfURL:(NSURL *)url error:(NSError **)outError; - (id)initWithData:(NSData *)data error:(NSError **)outError; - (BOOL)prepareToPlay; // always returns YES (lies!) - (BOOL)play; - (void)pause; - (void)stop; @property (readonly, getter=isPlaying) BOOL playing; @property float volume; @property NSInteger numberOfLoops; @property (assign) id delegate; @property (readonly) NSTimeInterval duration; @property NSTimeInterval currentTime; @property (readonly) NSURL *url; @property (readonly) NSData *data; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/AVFoundation/Classes/AVAudioPlayer.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "AVAudioPlayer.h" #import @implementation AVAudioPlayer @synthesize delegate=_delegate, url=_url, data=_data; - (id)init { if ((self=[super init])) { _numberOfLoops = 0; } return self; } - (id)initWithContentsOfURL:(NSURL *)url error:(NSError **)outError { if ((self=[self init])) { _url = [url retain]; _player = [[NSSound alloc] initWithContentsOfURL:_url byReference:YES]; [_player setDelegate:self]; } return self; } - (id)initWithData:(NSData *)data error:(NSError **)outError { if ((self=[self init])) { _data = [data retain]; _player = [[NSSound alloc] initWithData:_data]; [_player setDelegate:self]; } return self; } - (void)dealloc { [(NSSound *)_player stop]; // I swear the docs say that NSSound should stop itself when released, but I don't think it's doing that. Or else something else bad is going on. This helps for now. [_player release]; [_data release]; [_url release]; [super dealloc]; } - (BOOL)prepareToPlay { return YES; } - (BOOL)play { BOOL r = NO; @synchronized (self) { r = _isPaused? [(NSSound *)_player resume] : [(NSSound *)_player play]; _isPaused = NO; } return r; } - (void)pause { @synchronized (self) { if (!_isPaused) { _isPaused = YES; [(NSSound *)_player pause]; } } } - (void)stop { @synchronized (self) { [(NSSound *)_player stop]; _currentLoop = 0; _isPaused = NO; } } - (BOOL)isPlaying { @synchronized (self) { return [_player isPlaying]; } } - (float)volume { @synchronized (self) { return [_player volume]; } } - (void)setVolume:(float)v { @synchronized (self) { [_player setVolume:v]; } } - (NSInteger)numberOfLoops { @synchronized (self) { return _numberOfLoops; } } - (void)setNumberOfLoops:(NSInteger)loops { @synchronized (self) { _numberOfLoops = loops; _currentLoop = 0; } } - (NSTimeInterval)duration { @synchronized (self) { return [_player duration]; } } - (void)setCurrentTime:(NSTimeInterval)newTime { @synchronized (self) { [_player setCurrentTime:newTime]; } } - (NSTimeInterval)currentTime { @synchronized (self) { return [_player currentTime]; } } - (void)sound:(NSSound *)sound didFinishPlaying:(BOOL)finishedPlaying { @synchronized (self) { if (sound == _player) { const BOOL notifyDelegate = [_delegate respondsToSelector:@selector(audioPlayerDidFinishPlaying:successfully:)]; _isPaused = NO; if (finishedPlaying) { _currentLoop++; if (_currentLoop <= _numberOfLoops || _numberOfLoops < 0) { [_player play]; } else if (notifyDelegate) { [_delegate audioPlayerDidFinishPlaying:self successfully:YES]; } // According to the docs audioPlayerDidFinishPlaying should only be called if the audio finished playing // See: http://developer.apple.com/library/mac/#documentation/AVFoundation/Reference/AVAudioPlayerDelegateProtocolReference/Reference/Reference.html#//apple_ref/doc/uid/TP40008068 // } else { // [_delegate audioPlayerDidFinishPlaying:self successfully:NO]; } } } } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/AVFoundation/Classes/AVAudioSession.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import extern NSString *const AVAudioSessionCategoryAmbient; extern NSString *const AVAudioSessionCategorySoloAmbient; extern NSString *const AVAudioSessionCategoryPlayback; extern NSString *const AVAudioSessionCategoryRecord; extern NSString *const AVAudioSessionCategoryPlayAndRecord; extern NSString *const AVAudioSessionCategoryAudioProcessing; @interface AVAudioSession : NSObject { } + (id)sharedInstance; - (BOOL)setActive:(BOOL)beActive error:(NSError**)outError; - (BOOL)setCategory:(NSString*)theCategory error:(NSError**)outError; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/AVFoundation/Classes/AVAudioSession.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "AVAudioSession.h" NSString *const AVAudioSessionCategoryAmbient = @"AVAudioSessionCategoryAmbient"; NSString *const AVAudioSessionCategorySoloAmbient = @"AVAudioSessionCategorySoloAmbient"; NSString *const AVAudioSessionCategoryPlayback = @"AVAudioSessionCategoryPlayback"; NSString *const AVAudioSessionCategoryRecord = @"AVAudioSessionCategoryRecord"; NSString *const AVAudioSessionCategoryPlayAndRecord = @"AVAudioSessionCategoryPlayAndRecord"; NSString *const AVAudioSessionCategoryAudioProcessing = @"AVAudioSessionCategoryAudioProcessing"; @implementation AVAudioSession + (id)sharedInstance { return nil; } - (BOOL)setActive:(BOOL)beActive error:(NSError**)outError { return NO; } - (BOOL)setCategory:(NSString*)theCategory error:(NSError**)outError { return NO; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/AVFoundation/Classes/AVFoundation.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ // This probably doesn't belong here, but it's good enough for now enum { kSystemSoundID_Vibrate = 0x0 }; #import "AVAudioPlayer.h" #import "AVAudioSession.h" ================================================ FILE: Examples/Chameleon Demo/Chameleon/AVFoundation/Info.plist ================================================ CFBundleDevelopmentRegion English CFBundleExecutable ${EXECUTABLE_NAME} CFBundleName ${PRODUCT_NAME} CFBundleIconFile CFBundleIdentifier org.chameleonproject.AVFoundation CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType FMWK CFBundleSignature ???? CFBundleVersion 1 CFBundleShortVersionString 1.0 NSPrincipalClass ================================================ FILE: Examples/Chameleon Demo/Chameleon/AddressBookUI/AddressBookUI.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 143B578F1230357600F43562 /* ABUnknownPersonViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 14FB132C12302FD900B615ED /* ABUnknownPersonViewController.m */; }; 143B57941230357C00F43562 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 14FB133A1230307C00B615ED /* UIKit.framework */; }; 14C25EF31211ED0400622309 /* AddressBookUI.h in Headers */ = {isa = PBXBuildFile; fileRef = 14C25EF21211ED0400622309 /* AddressBookUI.h */; settings = {ATTRIBUTES = (Public, ); }; }; 14EFB1BB1211DB5300D19B0C /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 14EFB1BA1211DB5300D19B0C /* Cocoa.framework */; }; 14FB132D12302FD900B615ED /* ABUnknownPersonViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 14FB132B12302FD900B615ED /* ABUnknownPersonViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; 78CB48EA133ABCEB008636DA /* AddressBook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 78CB48E9133ABCEB008636DA /* AddressBook.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ 14FB13391230307C00B615ED /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 14FB13351230307C00B615ED /* UIKit.xcodeproj */; proxyType = 2; remoteGlobalIDString = 8DC2EF5B0486A6940098B216; remoteInfo = UIKit; }; 14FB133C1230308E00B615ED /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 14FB13351230307C00B615ED /* UIKit.xcodeproj */; proxyType = 1; remoteGlobalIDString = 8DC2EF4F0486A6940098B216; remoteInfo = UIKit; }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ 0867D69BFE84028FC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 0867D6A5FE840307C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 14C25EF21211ED0400622309 /* AddressBookUI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AddressBookUI.h; path = Classes/AddressBookUI.h; sourceTree = ""; }; 14EFB1BA1211DB5300D19B0C /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; 14FB132512302F8700B615ED /* AddressBookUI_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AddressBookUI_Prefix.pch; sourceTree = ""; }; 14FB132B12302FD900B615ED /* ABUnknownPersonViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ABUnknownPersonViewController.h; path = Classes/ABUnknownPersonViewController.h; sourceTree = ""; }; 14FB132C12302FD900B615ED /* ABUnknownPersonViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ABUnknownPersonViewController.m; path = Classes/ABUnknownPersonViewController.m; sourceTree = ""; }; 14FB13351230307C00B615ED /* UIKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = UIKit.xcodeproj; path = ../UIKit/UIKit.xcodeproj; sourceTree = SOURCE_ROOT; }; 78CB48E9133ABCEB008636DA /* AddressBook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBook.framework; path = System/Library/Frameworks/AddressBook.framework; sourceTree = SDKROOT; }; 8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 8DC2EF5B0486A6940098B216 /* AddressBookUI.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AddressBookUI.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 8DC2EF560486A6940098B216 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 78CB48EA133ABCEB008636DA /* AddressBook.framework in Frameworks */, 143B57941230357C00F43562 /* UIKit.framework in Frameworks */, 14EFB1BB1211DB5300D19B0C /* Cocoa.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 034768DFFF38A50411DB9C8B /* Products */ = { isa = PBXGroup; children = ( 8DC2EF5B0486A6940098B216 /* AddressBookUI.framework */, ); name = Products; sourceTree = ""; }; 0867D691FE84028FC02AAC07 /* UIKit */ = { isa = PBXGroup; children = ( 14FB13351230307C00B615ED /* UIKit.xcodeproj */, 08FB77AEFE84172EC02AAC07 /* Classes */, 089C1665FE841158C02AAC07 /* Resources */, 32C88DFF0371C24200C91783 /* Other Sources */, 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */, 034768DFFF38A50411DB9C8B /* Products */, ); name = UIKit; sourceTree = ""; }; 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = { isa = PBXGroup; children = ( 78CB48E9133ABCEB008636DA /* AddressBook.framework */, 0867D6A5FE840307C02AAC07 /* AppKit.framework */, 0867D69BFE84028FC02AAC07 /* Foundation.framework */, 14EFB1BA1211DB5300D19B0C /* Cocoa.framework */, ); name = "External Frameworks and Libraries"; sourceTree = ""; }; 089C1665FE841158C02AAC07 /* Resources */ = { isa = PBXGroup; children = ( 8DC2EF5A0486A6940098B216 /* Info.plist */, ); name = Resources; sourceTree = ""; }; 08FB77AEFE84172EC02AAC07 /* Classes */ = { isa = PBXGroup; children = ( 14C25EF21211ED0400622309 /* AddressBookUI.h */, 14FB132B12302FD900B615ED /* ABUnknownPersonViewController.h */, 14FB132C12302FD900B615ED /* ABUnknownPersonViewController.m */, ); name = Classes; sourceTree = ""; }; 14FB13361230307C00B615ED /* Products */ = { isa = PBXGroup; children = ( 14FB133A1230307C00B615ED /* UIKit.framework */, ); name = Products; sourceTree = ""; }; 32C88DFF0371C24200C91783 /* Other Sources */ = { isa = PBXGroup; children = ( 14FB132512302F8700B615ED /* AddressBookUI_Prefix.pch */, ); name = "Other Sources"; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ 8DC2EF500486A6940098B216 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( 14C25EF31211ED0400622309 /* AddressBookUI.h in Headers */, 14FB132D12302FD900B615ED /* ABUnknownPersonViewController.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ 8DC2EF4F0486A6940098B216 /* AddressBookUI */ = { isa = PBXNativeTarget; buildConfigurationList = 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "AddressBookUI" */; buildPhases = ( 8DC2EF500486A6940098B216 /* Headers */, 8DC2EF520486A6940098B216 /* Resources */, 8DC2EF540486A6940098B216 /* Sources */, 8DC2EF560486A6940098B216 /* Frameworks */, ); buildRules = ( ); dependencies = ( 14FB133D1230308E00B615ED /* PBXTargetDependency */, ); name = AddressBookUI; productInstallPath = "$(HOME)/Library/Frameworks"; productName = UIKit; productReference = 8DC2EF5B0486A6940098B216 /* AddressBookUI.framework */; productType = "com.apple.product-type.framework"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 0867D690FE84028FC02AAC07 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0510; }; buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "AddressBookUI" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( English, Japanese, French, German, ); mainGroup = 0867D691FE84028FC02AAC07 /* UIKit */; productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; projectDirPath = ""; projectReferences = ( { ProductGroup = 14FB13361230307C00B615ED /* Products */; ProjectRef = 14FB13351230307C00B615ED /* UIKit.xcodeproj */; }, ); projectRoot = ""; targets = ( 8DC2EF4F0486A6940098B216 /* AddressBookUI */, ); }; /* End PBXProject section */ /* Begin PBXReferenceProxy section */ 14FB133A1230307C00B615ED /* UIKit.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; path = UIKit.framework; remoteRef = 14FB13391230307C00B615ED /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXReferenceProxy section */ /* Begin PBXResourcesBuildPhase section */ 8DC2EF520486A6940098B216 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 8DC2EF540486A6940098B216 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 143B578F1230357600F43562 /* ABUnknownPersonViewController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ 14FB133D1230308E00B615ED /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = UIKit; targetProxy = 14FB133C1230308E00B615ED /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ 1DEB91AE08733DA50010E9CD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = AddressBookUI_Prefix.pch; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; PRODUCT_NAME = AddressBookUI; SYMROOT = ../build; VALID_ARCHS = "i386 x86_64"; WRAPPER_EXTENSION = framework; }; name = Debug; }; 1DEB91AF08733DA50010E9CD /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = AddressBookUI_Prefix.pch; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; PRODUCT_NAME = AddressBookUI; SYMROOT = ../build; VALID_ARCHS = "i386 x86_64"; WRAPPER_EXTENSION = framework; }; name = Release; }; 1DEB91B208733DA50010E9CD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; ONLY_ACTIVE_ARCH = YES; PREBINDING = NO; SDKROOT = macosx; }; name = Debug; }; 1DEB91B308733DA50010E9CD /* Release */ = { isa = XCBuildConfiguration; buildSettings = { GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; PREBINDING = NO; SDKROOT = macosx; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "AddressBookUI" */ = { isa = XCConfigurationList; buildConfigurations = ( 1DEB91AE08733DA50010E9CD /* Debug */, 1DEB91AF08733DA50010E9CD /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "AddressBookUI" */ = { isa = XCConfigurationList; buildConfigurations = ( 1DEB91B208733DA50010E9CD /* Debug */, 1DEB91B308733DA50010E9CD /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 0867D690FE84028FC02AAC07 /* Project object */; } ================================================ FILE: Examples/Chameleon Demo/Chameleon/AddressBookUI/AddressBookUI.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: Examples/Chameleon Demo/Chameleon/AddressBookUI/AddressBookUI_Prefix.pch ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifdef __OBJC__ #import #endif ================================================ FILE: Examples/Chameleon Demo/Chameleon/AddressBookUI/Classes/ABUnknownPersonViewController.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import typedef id ABRecordRef; // is iOS-only @interface ABUnknownPersonViewController : NSObject { ABRecordRef _displayedPerson; } @property (nonatomic, retain) ABRecordRef displayedPerson; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/AddressBookUI/Classes/ABUnknownPersonViewController.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "ABUnknownPersonViewController.h" @implementation ABUnknownPersonViewController @synthesize displayedPerson = _displayedPerson; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/AddressBookUI/Classes/AddressBookUI.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "ABUnknownPersonViewController.h" ================================================ FILE: Examples/Chameleon Demo/Chameleon/AddressBookUI/Info.plist ================================================ CFBundleDevelopmentRegion English CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIconFile CFBundleIdentifier org.chameleonproject.AddressBookUI CFBundleInfoDictionaryVersion 6.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType FMWK CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1 NSPrincipalClass ================================================ FILE: Examples/Chameleon Demo/Chameleon/AssetsLibrary/AssetsLibrary.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 144E375F14D7559600A640AE /* ALAsset.h in Headers */ = {isa = PBXBuildFile; fileRef = 144E375D14D7559600A640AE /* ALAsset.h */; settings = {ATTRIBUTES = (Public, ); }; }; 144E376014D7559600A640AE /* ALAsset.m in Sources */ = {isa = PBXBuildFile; fileRef = 144E375E14D7559600A640AE /* ALAsset.m */; }; 144E376314D755E300A640AE /* ALAssetRepresentation.h in Headers */ = {isa = PBXBuildFile; fileRef = 144E376114D755E300A640AE /* ALAssetRepresentation.h */; settings = {ATTRIBUTES = (Public, ); }; }; 144E376414D755E300A640AE /* ALAssetRepresentation.m in Sources */ = {isa = PBXBuildFile; fileRef = 144E376214D755E300A640AE /* ALAssetRepresentation.m */; }; 144E376714D755FE00A640AE /* ALAssetsFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 144E376514D755FE00A640AE /* ALAssetsFilter.h */; settings = {ATTRIBUTES = (Public, ); }; }; 144E376814D755FE00A640AE /* ALAssetsFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = 144E376614D755FE00A640AE /* ALAssetsFilter.m */; }; 144E376B14D7561600A640AE /* ALAssetsGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = 144E376914D7561600A640AE /* ALAssetsGroup.h */; settings = {ATTRIBUTES = (Public, ); }; }; 144E376C14D7561600A640AE /* ALAssetsGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = 144E376A14D7561600A640AE /* ALAssetsGroup.m */; }; 14EFB1A11211DADE00D19B0C /* ALAssetsLibrary.h in Headers */ = {isa = PBXBuildFile; fileRef = 14EFB19F1211DADE00D19B0C /* ALAssetsLibrary.h */; settings = {ATTRIBUTES = (Public, ); }; }; 14EFB1A21211DADE00D19B0C /* ALAssetsLibrary.m in Sources */ = {isa = PBXBuildFile; fileRef = 14EFB1A01211DADE00D19B0C /* ALAssetsLibrary.m */; }; 14EFB1A81211DB0B00D19B0C /* AssetsLibrary.h in Headers */ = {isa = PBXBuildFile; fileRef = 14EFB1A71211DB0B00D19B0C /* AssetsLibrary.h */; settings = {ATTRIBUTES = (Public, ); }; }; 14EFB1BB1211DB5300D19B0C /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 14EFB1BA1211DB5300D19B0C /* Cocoa.framework */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 0867D69BFE84028FC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 0867D6A5FE840307C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 144E375D14D7559600A640AE /* ALAsset.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ALAsset.h; path = Classes/ALAsset.h; sourceTree = ""; }; 144E375E14D7559600A640AE /* ALAsset.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ALAsset.m; path = Classes/ALAsset.m; sourceTree = ""; }; 144E376114D755E300A640AE /* ALAssetRepresentation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ALAssetRepresentation.h; path = Classes/ALAssetRepresentation.h; sourceTree = ""; }; 144E376214D755E300A640AE /* ALAssetRepresentation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ALAssetRepresentation.m; path = Classes/ALAssetRepresentation.m; sourceTree = ""; }; 144E376514D755FE00A640AE /* ALAssetsFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ALAssetsFilter.h; path = Classes/ALAssetsFilter.h; sourceTree = ""; }; 144E376614D755FE00A640AE /* ALAssetsFilter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ALAssetsFilter.m; path = Classes/ALAssetsFilter.m; sourceTree = ""; }; 144E376914D7561600A640AE /* ALAssetsGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ALAssetsGroup.h; path = Classes/ALAssetsGroup.h; sourceTree = ""; }; 144E376A14D7561600A640AE /* ALAssetsGroup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ALAssetsGroup.m; path = Classes/ALAssetsGroup.m; sourceTree = ""; }; 146B1C8C1211D9DA002D85C3 /* AssetsLibrary_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AssetsLibrary_Prefix.pch; sourceTree = ""; }; 14EFB19F1211DADE00D19B0C /* ALAssetsLibrary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ALAssetsLibrary.h; path = Classes/ALAssetsLibrary.h; sourceTree = ""; }; 14EFB1A01211DADE00D19B0C /* ALAssetsLibrary.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ALAssetsLibrary.m; path = Classes/ALAssetsLibrary.m; sourceTree = ""; }; 14EFB1A71211DB0B00D19B0C /* AssetsLibrary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AssetsLibrary.h; path = Classes/AssetsLibrary.h; sourceTree = ""; }; 14EFB1BA1211DB5300D19B0C /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; 8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 8DC2EF5B0486A6940098B216 /* AssetsLibrary.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AssetsLibrary.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 8DC2EF560486A6940098B216 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 14EFB1BB1211DB5300D19B0C /* Cocoa.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 034768DFFF38A50411DB9C8B /* Products */ = { isa = PBXGroup; children = ( 8DC2EF5B0486A6940098B216 /* AssetsLibrary.framework */, ); name = Products; sourceTree = ""; }; 0867D691FE84028FC02AAC07 /* UIKit */ = { isa = PBXGroup; children = ( 08FB77AEFE84172EC02AAC07 /* Classes */, 089C1665FE841158C02AAC07 /* Resources */, 32C88DFF0371C24200C91783 /* Other Sources */, 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */, 034768DFFF38A50411DB9C8B /* Products */, ); name = UIKit; sourceTree = ""; }; 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = { isa = PBXGroup; children = ( 0867D6A5FE840307C02AAC07 /* AppKit.framework */, 0867D69BFE84028FC02AAC07 /* Foundation.framework */, 14EFB1BA1211DB5300D19B0C /* Cocoa.framework */, ); name = "External Frameworks and Libraries"; sourceTree = ""; }; 089C1665FE841158C02AAC07 /* Resources */ = { isa = PBXGroup; children = ( 8DC2EF5A0486A6940098B216 /* Info.plist */, ); name = Resources; sourceTree = ""; }; 08FB77AEFE84172EC02AAC07 /* Classes */ = { isa = PBXGroup; children = ( 144E375D14D7559600A640AE /* ALAsset.h */, 144E375E14D7559600A640AE /* ALAsset.m */, 144E376114D755E300A640AE /* ALAssetRepresentation.h */, 144E376214D755E300A640AE /* ALAssetRepresentation.m */, 144E376514D755FE00A640AE /* ALAssetsFilter.h */, 144E376614D755FE00A640AE /* ALAssetsFilter.m */, 144E376914D7561600A640AE /* ALAssetsGroup.h */, 144E376A14D7561600A640AE /* ALAssetsGroup.m */, 14EFB19F1211DADE00D19B0C /* ALAssetsLibrary.h */, 14EFB1A01211DADE00D19B0C /* ALAssetsLibrary.m */, 14EFB1A71211DB0B00D19B0C /* AssetsLibrary.h */, ); name = Classes; sourceTree = ""; }; 32C88DFF0371C24200C91783 /* Other Sources */ = { isa = PBXGroup; children = ( 146B1C8C1211D9DA002D85C3 /* AssetsLibrary_Prefix.pch */, ); name = "Other Sources"; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ 8DC2EF500486A6940098B216 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( 14EFB1A11211DADE00D19B0C /* ALAssetsLibrary.h in Headers */, 14EFB1A81211DB0B00D19B0C /* AssetsLibrary.h in Headers */, 144E375F14D7559600A640AE /* ALAsset.h in Headers */, 144E376314D755E300A640AE /* ALAssetRepresentation.h in Headers */, 144E376714D755FE00A640AE /* ALAssetsFilter.h in Headers */, 144E376B14D7561600A640AE /* ALAssetsGroup.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ 8DC2EF4F0486A6940098B216 /* AssetsLibrary */ = { isa = PBXNativeTarget; buildConfigurationList = 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "AssetsLibrary" */; buildPhases = ( 8DC2EF500486A6940098B216 /* Headers */, 8DC2EF520486A6940098B216 /* Resources */, 8DC2EF540486A6940098B216 /* Sources */, 8DC2EF560486A6940098B216 /* Frameworks */, ); buildRules = ( ); dependencies = ( ); name = AssetsLibrary; productInstallPath = "$(HOME)/Library/Frameworks"; productName = UIKit; productReference = 8DC2EF5B0486A6940098B216 /* AssetsLibrary.framework */; productType = "com.apple.product-type.framework"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 0867D690FE84028FC02AAC07 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0510; }; buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "AssetsLibrary" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( English, Japanese, French, German, ); mainGroup = 0867D691FE84028FC02AAC07 /* UIKit */; productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 8DC2EF4F0486A6940098B216 /* AssetsLibrary */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 8DC2EF520486A6940098B216 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 8DC2EF540486A6940098B216 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 14EFB1A21211DADE00D19B0C /* ALAssetsLibrary.m in Sources */, 144E376014D7559600A640AE /* ALAsset.m in Sources */, 144E376414D755E300A640AE /* ALAssetRepresentation.m in Sources */, 144E376814D755FE00A640AE /* ALAssetsFilter.m in Sources */, 144E376C14D7561600A640AE /* ALAssetsGroup.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin XCBuildConfiguration section */ 1DEB91AE08733DA50010E9CD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COMBINE_HIDPI_IMAGES = NO; COPY_PHASE_STRIP = NO; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; GCC_DYNAMIC_NO_PIC = NO; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = AssetsLibrary_Prefix.pch; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; PRODUCT_NAME = AssetsLibrary; SYMROOT = ../build; WRAPPER_EXTENSION = framework; }; name = Debug; }; 1DEB91AF08733DA50010E9CD /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COMBINE_HIDPI_IMAGES = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = AssetsLibrary_Prefix.pch; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; PRODUCT_NAME = AssetsLibrary; SYMROOT = ../build; WRAPPER_EXTENSION = framework; }; name = Release; }; 1DEB91B208733DA50010E9CD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.7; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; }; name = Debug; }; 1DEB91B308733DA50010E9CD /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = "Developer ID Application: The Iconfactory"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.7; PROVISIONING_PROFILE = ""; SDKROOT = macosx; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "AssetsLibrary" */ = { isa = XCConfigurationList; buildConfigurations = ( 1DEB91AE08733DA50010E9CD /* Debug */, 1DEB91AF08733DA50010E9CD /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "AssetsLibrary" */ = { isa = XCConfigurationList; buildConfigurations = ( 1DEB91B208733DA50010E9CD /* Debug */, 1DEB91B308733DA50010E9CD /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 0867D690FE84028FC02AAC07 /* Project object */; } ================================================ FILE: Examples/Chameleon Demo/Chameleon/AssetsLibrary/AssetsLibrary_Prefix.pch ================================================ /* * Copyright (c) 2012, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifdef __OBJC__ #import #endif ================================================ FILE: Examples/Chameleon Demo/Chameleon/AssetsLibrary/Classes/ALAsset.h ================================================ /* * Copyright (c) 2012, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @interface ALAsset : NSObject @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/AssetsLibrary/Classes/ALAsset.m ================================================ /* * Copyright (c) 2012, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "ALAsset.h" @implementation ALAsset @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/AssetsLibrary/Classes/ALAssetRepresentation.h ================================================ /* * Copyright (c) 2012, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @interface ALAssetRepresentation : NSObject @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/AssetsLibrary/Classes/ALAssetRepresentation.m ================================================ /* * Copyright (c) 2012, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "ALAssetRepresentation.h" @implementation ALAssetRepresentation @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/AssetsLibrary/Classes/ALAssetsFilter.h ================================================ /* * Copyright (c) 2012, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @interface ALAssetsFilter : NSObject @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/AssetsLibrary/Classes/ALAssetsFilter.m ================================================ /* * Copyright (c) 2012, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "ALAssetsFilter.h" @implementation ALAssetsFilter @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/AssetsLibrary/Classes/ALAssetsGroup.h ================================================ /* * Copyright (c) 2012, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @class ALAsset; typedef void (^ALAssetsGroupEnumerationResultsBlock)(ALAsset *result, NSUInteger index, BOOL *stop); @interface ALAssetsGroup : NSObject @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/AssetsLibrary/Classes/ALAssetsGroup.m ================================================ /* * Copyright (c) 2012, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "ALAssetsGroup.h" @implementation ALAssetsGroup @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/AssetsLibrary/Classes/ALAssetsLibrary.h ================================================ /* * Copyright (c) 2012, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @class ALAssetsGroup, ALAsset; typedef NSUInteger ALAssetsGroupType; enum { ALAssetsGroupLibrary = (1 << 0), ALAssetsGroupAlbum = (1 << 1), ALAssetsGroupEvent = (1 << 2), ALAssetsGroupFaces = (1 << 3), ALAssetsGroupSavedPhotos = (1 << 4), ALAssetsGroupPhotoStream = (1 << 5), ALAssetsGroupAll = 0xFFFFFFFF, }; typedef enum { ALAssetOrientationUp, ALAssetOrientationDown, ALAssetOrientationLeft, ALAssetOrientationRight, ALAssetOrientationUpMirrored, ALAssetOrientationDownMirrored, ALAssetOrientationLeftMirrored, ALAssetOrientationRightMirrored, } ALAssetOrientation; typedef void (^ALAssetsLibraryGroupsEnumerationResultsBlock)(ALAssetsGroup *group, BOOL *stop); typedef void (^ALAssetsLibraryAssetForURLResultBlock)(ALAsset *asset); typedef void (^ALAssetsLibraryWriteImageCompletionBlock)(NSURL *assetURL, NSError *error); typedef void (^ALAssetsLibraryWriteVideoCompletionBlock)(NSURL *assetURL, NSError *error); typedef void (^ALAssetsLibraryAccessFailureBlock)(NSError *error); typedef void (^ALAssetsLibraryGroupResultBlock)(ALAssetsGroup *group); enum { ALAssetsLibraryUnknownError = -1, ALAssetsLibraryWriteFailedError = -3300, ALAssetsLibraryWriteBusyError = -3301, ALAssetsLibraryWriteInvalidDataError = -3302, ALAssetsLibraryWriteIncompatibleDataError = -3303, ALAssetsLibraryWriteDataEncodingError = -3304, ALAssetsLibraryWriteDiskSpaceError = -3305, ALAssetsLibraryDataUnavailableError = -3310, ALAssetsLibraryAccessUserDeniedError = -3311, ALAssetsLibraryAccessGloballyDeniedError = -3312, }; extern NSString *const ALAssetsLibraryErrorDomain; extern NSString *const ALAssetsLibraryChangedNotification; @interface ALAssetsLibrary : NSObject - (void)writeImageDataToSavedPhotosAlbum:(NSData *)imageData metadata:(NSDictionary *)metadata completionBlock:(ALAssetsLibraryWriteImageCompletionBlock)completionBlock; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/AssetsLibrary/Classes/ALAssetsLibrary.m ================================================ /* * Copyright (c) 2012, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "ALAssetsLibrary.h" #import #import NSString *const ALAssetsLibraryErrorDomain = @"ALAssetsLibraryErrorDomain"; NSString *const ALAssetsLibraryChangedNotification = @"ALAssetsLibraryChangedNotification"; static NSString *UTIForImageData(NSData *data) { NSString *type = nil; CGImageSourceRef imageSource = CGImageSourceCreateWithData((CFDataRef)data, NULL); if (imageSource) { type = [[(NSString *)CGImageSourceGetType(imageSource) copy] autorelease]; CFRelease(imageSource); } return type; } @implementation ALAssetsLibrary - (void)_deferredBlock:(void (^)(void))block { block(); } - (void)writeImageDataToSavedPhotosAlbum:(NSData *)imageData metadata:(NSDictionary *)metadata completionBlock:(ALAssetsLibraryWriteImageCompletionBlock)completionBlock { // Chameleon's UIKit has an internal class called UIPhotosAlbum which was used to implement // UIImageWriteToSavedPhotosAlbum(). Somehow it'd be nice if these things shared code, but I don't // really want to make UIKit depend on having AssetsLibrary. Since I wasn't sure how to best accomplish // that, it's just duplicated here for now in a slightly different way so that we can support writing // any sort of image data and not just PNGs. // The actual presentation of the save dialog and the saving itself is deferred because that's how // my UIImageWriteToSavedPhotosAlbum() did it and ALAssetsLibrary says these methods are asynchronous // so we'll pretend that's okay. if (imageData) { ALAssetsLibraryWriteImageCompletionBlock doneBlock = [completionBlock copy]; [self performSelector:@selector(_deferredBlock:) withObject:[[^{ NSError *error = nil; NSSavePanel *panel = [NSSavePanel savePanel]; NSString *fileType = UTIForImageData(imageData); if (fileType) { [panel setAllowedFileTypes:[NSArray arrayWithObject:fileType]]; } if (NSFileHandlingPanelOKButton == [panel runModal] && [panel URL]) { [imageData writeToURL:[panel URL] options:NSDataWritingAtomic error:&error]; } else { error = [NSError errorWithDomain:@"save panel cancelled" code:1 userInfo:nil]; } if (doneBlock) { doneBlock([panel URL], error); [doneBlock release]; } } copy] autorelease] afterDelay:0]; } } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/AssetsLibrary/Classes/AssetsLibrary.h ================================================ /* * Copyright (c) 2012, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "ALAsset.h" #import "ALAssetRepresentation.h" #import "ALAssetsFilter.h" #import "ALAssetsGroup.h" #import "ALAssetsLibrary.h" ================================================ FILE: Examples/Chameleon Demo/Chameleon/AssetsLibrary/Info.plist ================================================ CFBundleDevelopmentRegion English CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIconFile CFBundleIdentifier org.chameleonproject.AssetsLibrary CFBundleInfoDictionaryVersion 6.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType FMWK CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1 NSPrincipalClass ================================================ FILE: Examples/Chameleon Demo/Chameleon/LICENSE ================================================ Copyright (c) 2011, The Iconfactory. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of The Iconfactory nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================ FILE: Examples/Chameleon Demo/Chameleon/MediaPlayer/Classes/MPMediaPlayback.h ================================================ // // MPMediaPlayback.h // MediaPlayer // // Created by Michael Dales on 08/07/2011. // Copyright 2011 Digital Flapjack Ltd. All rights reserved. // #import @protocol MPMediaPlayback - (void)play; - (void)pause; - (void)prepareToPlay; - (void)stop; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/MediaPlayer/Classes/MPMoviePlayerController.h ================================================ // // MPMoviewPlayerController.h // MediaPlayer // // Created by Michael Dales on 08/07/2011. // Copyright 2011 Digital Flapjack Ltd. All rights reserved. // #import #import "MPMediaPlayback.h" #import enum { MPMovieLoadStateUnknown = 0, MPMovieLoadStatePlayable = 1 << 0, MPMovieLoadStatePlaythroughOK = 1 << 1, MPMovieLoadStateStalled = 1 << 2, }; typedef NSInteger MPMovieLoadState; enum { MPMovieControlStyleNone, MPMovieControlStyleEmbedded, MPMovieControlStyleFullscreen, MPMovieControlStyleDefault = MPMovieControlStyleFullscreen }; typedef NSInteger MPMovieControlStyle; enum { MPMovieFinishReasonPlaybackEnded, MPMovieFinishReasonPlaybackError, MPMovieFinishReasonUserExited }; typedef NSInteger MPMovieFinishReason; enum { MPMovieSourceTypeUnknown, MPMovieSourceTypeFile, MPMovieSourceTypeStreaming }; typedef NSInteger MPMovieSourceType; enum { MPMovieRepeatModeNone, MPMovieRepeatModeOne }; typedef NSInteger MPMovieRepeatMode; enum { MPMoviePlaybackStateStopped, MPMoviePlaybackStatePlaying, MPMoviePlaybackStatePaused, MPMoviePlaybackStateInterrupted, MPMoviePlaybackStateSeekingForward, MPMoviePlaybackStateSeekingBackward }; typedef NSInteger MPMoviePlaybackState; typedef enum { MPMovieScalingModeNone, MPMovieScalingModeAspectFit, MPMovieScalingModeAspectFill, MPMovieScalingModeFill } MPMovieScalingMode; extern NSString *const MPMoviePlayerPlaybackDidFinishReasonUserInfoKey; // notifications extern NSString *const MPMoviePlayerPlaybackStateDidChangeNotification; extern NSString *const MPMoviePlayerPlaybackDidFinishNotification; extern NSString *const MPMoviePlayerLoadStateDidChangeNotification; extern NSString *const MPMovieDurationAvailableNotification; @class UIInternalMovieView; @interface MPMoviePlayerController : NSObject { @private UIInternalMovieView *movieView; QTMovie *movie; } @property (nonatomic, readonly) UIView *view; @property (nonatomic, readonly) MPMovieLoadState loadState; @property (nonatomic, copy) NSURL *contentURL; @property (nonatomic) MPMovieControlStyle controlStyle; @property (nonatomic) MPMovieSourceType movieSourceType; // A view for customization which is always displayed behind movie content. @property(nonatomic, readonly) UIView *backgroundView; @property (nonatomic, readonly) MPMoviePlaybackState playbackState; @property (nonatomic) MPMovieRepeatMode repeatMode; // Indicates if a movie should automatically start playback when it is likely to finish uninterrupted based on e.g. network conditions. Defaults to YES. @property(nonatomic) BOOL shouldAutoplay; @property (nonatomic, readonly) NSTimeInterval duration; @property (nonatomic) MPMovieScalingMode scalingMode; - (id)initWithContentURL: (NSURL*)url; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/MediaPlayer/Classes/MPMoviePlayerController.m ================================================ // // MPMoviewPlayerController.m // MediaPlayer // // Created by Michael Dales on 08/07/2011. // Copyright 2011 Digital Flapjack Ltd. All rights reserved. // #import "MPMoviePlayerController.h" #import "UIInternalMovieView.h" NSString *const MPMoviePlayerPlaybackDidFinishReasonUserInfoKey = @"MPMoviePlayerPlaybackDidFinishReasonUserInfoKey"; // notifications NSString *const MPMoviePlayerPlaybackStateDidChangeNotification = @"MPMoviePlayerPlaybackStateDidChangeNotification"; NSString *const MPMoviePlayerPlaybackDidFinishNotification = @"MPMoviePlayerPlaybackDidFinishNotification"; NSString *const MPMoviePlayerLoadStateDidChangeNotification = @"MPMoviePlayerLoadStateDidChangeNotification"; NSString *const MPMovieDurationAvailableNotification = @"MPMovieDurationAvailableNotification"; @implementation MPMoviePlayerController @synthesize view=_view; @synthesize loadState=_loadState; @synthesize contentURL=_contentURL; @synthesize controlStyle=_controlStyle; @synthesize movieSourceType=_movieSourceType; @synthesize backgroundView; @synthesize playbackState=_playbackState; @synthesize repeatMode=_repeatMode; @synthesize shouldAutoplay; @synthesize scalingMode=_scalingMode; /////////////////////////////////////////////////////////////////////////////// // - (void)setScalingMode:(MPMovieScalingMode)scalingMode { _scalingMode = scalingMode; movieView.scalingMode = scalingMode; } /////////////////////////////////////////////////////////////////////////////// // - (void)setRepeatMode:(MPMovieRepeatMode)repeatMode { _repeatMode = repeatMode; [movie setAttribute: [NSNumber numberWithBool: repeatMode == MPMovieRepeatModeOne] forKey: QTMovieLoopsAttribute]; } /////////////////////////////////////////////////////////////////////////////// // - (NSTimeInterval)duration { QTTime time = [movie duration]; NSTimeInterval interval; if (QTGetTimeInterval(time, &interval)) return interval; else return 0.0; } /////////////////////////////////////////////////////////////////////////////// // - (UIView*)view { return movieView; } /////////////////////////////////////////////////////////////////////////////// // - (MPMovieLoadState)loadState { NSNumber* loadState = [movie attributeForKey: QTMovieLoadStateAttribute]; switch ([loadState intValue]) { case QTMovieLoadStateError: { NSLog(@"woo"); NSNumber *stopCode = [NSNumber numberWithInt: MPMovieFinishReasonPlaybackError]; NSDictionary *userInfo = [NSDictionary dictionaryWithObject: stopCode forKey: MPMoviePlayerPlaybackDidFinishReasonUserInfoKey]; // if there's a loading error we generate a stop notification [[NSNotificationCenter defaultCenter] postNotificationName: MPMoviePlayerPlaybackDidFinishNotification object: self userInfo: userInfo]; _loadState = MPMovieLoadStateUnknown; } break; case QTMovieLoadStateLoading: _loadState = MPMovieLoadStateUnknown; break; case QTMovieLoadStateLoaded: // we have the meta data, so post the duration available notification [[NSNotificationCenter defaultCenter] postNotificationName: MPMovieDurationAvailableNotification object: self]; _loadState = MPMovieLoadStateUnknown; break; case QTMovieLoadStatePlayable: _loadState = MPMovieLoadStatePlayable; break; case QTMovieLoadStatePlaythroughOK: _loadState = MPMovieLoadStatePlaythroughOK; break; case QTMovieLoadStateComplete: _loadState = MPMovieLoadStatePlaythroughOK; break; } return _loadState; } #pragma mark - notifications /////////////////////////////////////////////////////////////////////////////// // - (void)didEndOccurred: (NSNotification*)notification { if (notification.object != movie) return; _playbackState = MPMoviePlaybackStateStopped; NSNumber *stopCode = [NSNumber numberWithInt: MPMovieFinishReasonPlaybackEnded]; NSDictionary *userInfo = [NSDictionary dictionaryWithObject: stopCode forKey: MPMoviePlayerPlaybackDidFinishReasonUserInfoKey]; [[NSNotificationCenter defaultCenter] postNotificationName: MPMoviePlayerPlaybackDidFinishNotification object: self userInfo: userInfo]; } /////////////////////////////////////////////////////////////////////////////// // - (void)loadStateChangeOccurred: (NSNotification*)notification { if (notification.object != movie) return; [[NSNotificationCenter defaultCenter] postNotificationName: MPMoviePlayerLoadStateDidChangeNotification object: self]; } #pragma mark - constructor/destructor /////////////////////////////////////////////////////////////////////////////// // - (id)initWithContentURL:(NSURL *)url { self = [super init]; if (self) { _contentURL = [url retain]; _loadState = MPMovieLoadStateUnknown; _controlStyle = MPMovieControlStyleDefault; _movieSourceType = MPMovieSourceTypeUnknown; _playbackState = MPMoviePlaybackStateStopped; _repeatMode = MPMovieRepeatModeNone; NSError *error = nil; movie = [[QTMovie alloc] initWithURL: url error: &error]; movieView = [[UIInternalMovieView alloc] initWithMovie: movie]; self.scalingMode = MPMovieScalingModeAspectFit; [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(loadStateChangeOccurred:) name: QTMovieLoadStateDidChangeNotification object: nil]; [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(didEndOccurred:) name: QTMovieDidEndNotification object: nil]; } return self; } /////////////////////////////////////////////////////////////////////////////// // - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver: self]; [_view release]; [super dealloc]; } #pragma mark - MPMediaPlayback /////////////////////////////////////////////////////////////////////////////// // - (void)play { [movie play]; _playbackState = MPMoviePlaybackStatePlaying; } /////////////////////////////////////////////////////////////////////////////// // - (void)pause { [movie stop]; _playbackState = MPMoviePlaybackStatePaused; } /////////////////////////////////////////////////////////////////////////////// // - (void)prepareToPlay { // Do nothing } /////////////////////////////////////////////////////////////////////////////// // - (void)stop { [movie stop]; _playbackState = MPMoviePlaybackStateStopped; } #pragma mark - Pending - (void) setShouldAutoplay:(BOOL)shouldAutoplay { NSLog(@"[CHAMELEON] MPMoviePlayerController.shouldAutoplay not implemented"); } - (UIView*) backgroundView { NSLog(@"[CHAMELEON] MPMoviePlayerController.backgroundView not implemented"); return nil; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/MediaPlayer/Classes/MPMusicPlayerController.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import enum { MPMusicPlaybackStateStopped, MPMusicPlaybackStatePlaying, MPMusicPlaybackStatePaused, MPMusicPlaybackStateInterrupted, MPMusicPlaybackStateSeekingForward, MPMusicPlaybackStateSeekingBackward }; typedef NSInteger MPMusicPlaybackState; extern NSString *const MPMusicPlayerControllerPlaybackStateDidChangeNotification; @interface MPMusicPlayerController : NSObject { } + (MPMusicPlayerController *)iPodMusicPlayer; - (void)beginGeneratingPlaybackNotifications; - (void)endGeneratingPlaybackNotifications; @property (nonatomic, readonly) MPMusicPlaybackState playbackState; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/MediaPlayer/Classes/MPMusicPlayerController.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "MPMusicPlayerController.h" NSString *const MPMusicPlayerControllerPlaybackStateDidChangeNotification = @"MPMusicPlayerControllerPlaybackStateDidChangeNotification"; @implementation MPMusicPlayerController + (MPMusicPlayerController *)iPodMusicPlayer { return nil; } - (MPMusicPlaybackState)playbackState { return MPMusicPlaybackStateStopped; } - (void)beginGeneratingPlaybackNotifications { } - (void)endGeneratingPlaybackNotifications { } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/MediaPlayer/Classes/MediaPlayer.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "MPMusicPlayerController.h" #import "MPMoviePlayerController.h" ================================================ FILE: Examples/Chameleon Demo/Chameleon/MediaPlayer/Classes/UIInternalMovieView.h ================================================ // // UIInternalMovieView.h // MediaPlayer // // Created by Michael Dales on 08/07/2011. // Copyright 2011 Digital Flapjack Ltd. All rights reserved. // #import #import #import "MPMoviePlayerController.h" @interface UIInternalMovieView : UIView { @private QTMovieLayer *movieLayer; } @property (nonatomic, retain) QTMovie* movie; @property (nonatomic, assign) MPMovieScalingMode scalingMode; - (id)initWithMovie: (QTMovie*)movie; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/MediaPlayer/Classes/UIInternalMovieView.m ================================================ // // UIInternalMovieView.m // MediaPlayer // // Created by Michael Dales on 08/07/2011. // Copyright 2011 Digital Flapjack Ltd. All rights reserved. // #import "UIInternalMovieView.h" @implementation UIInternalMovieView @synthesize movie=_movie; @synthesize scalingMode=_scalingMode; /////////////////////////////////////////////////////////////////////////////// // - (void)setScalingMode:(MPMovieScalingMode)scalingMode { _scalingMode = scalingMode; switch (scalingMode) { case MPMovieScalingModeNone: movieLayer.contentsGravity = kCAGravityCenter; break; case MPMovieScalingModeAspectFit: movieLayer.contentsGravity = kCAGravityResizeAspect; break; case MPMovieScalingModeAspectFill: movieLayer.contentsGravity = kCAGravityResizeAspectFill; break; case MPMovieScalingModeFill: movieLayer.contentsGravity = kCAGravityResize; break; } } /////////////////////////////////////////////////////////////////////////////// // - (id)initWithMovie:(QTMovie *)movie { if ((self = [super init]) != nil) { self.movie = movie; movieLayer = [[QTMovieLayer alloc] initWithMovie: movie]; [self.layer addSublayer: movieLayer]; } return self; } /////////////////////////////////////////////////////////////////////////////// // - (void)dealloc { [_movie release]; [super dealloc]; } /////////////////////////////////////////////////////////////////////////////// // - (void)setFrame:(CGRect)frame { [super setFrame: frame]; [movieLayer setFrame: frame]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/MediaPlayer/Info.plist ================================================ CFBundleDevelopmentRegion English CFBundleExecutable ${EXECUTABLE_NAME} CFBundleName ${PRODUCT_NAME} CFBundleIconFile CFBundleIdentifier org.chameleonproject.MediaPlayer CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType FMWK CFBundleSignature ???? CFBundleVersion 1 CFBundleShortVersionString 1.0 NSPrincipalClass ================================================ FILE: Examples/Chameleon Demo/Chameleon/MediaPlayer/MediaPlayer.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 14C25EF31211ED0400622309 /* MediaPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 14C25EF21211ED0400622309 /* MediaPlayer.h */; settings = {ATTRIBUTES = (Public, ); }; }; 14C25F001211ED4C00622309 /* MPMusicPlayerController.h in Headers */ = {isa = PBXBuildFile; fileRef = 14C25EFE1211ED4C00622309 /* MPMusicPlayerController.h */; settings = {ATTRIBUTES = (Public, ); }; }; 14C25F011211ED4C00622309 /* MPMusicPlayerController.m in Sources */ = {isa = PBXBuildFile; fileRef = 14C25EFF1211ED4C00622309 /* MPMusicPlayerController.m */; }; 14EFB1BB1211DB5300D19B0C /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 14EFB1BA1211DB5300D19B0C /* Cocoa.framework */; }; 4C1677D913C70F1A00814195 /* MPMoviePlayerController.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C1677D713C70F1900814195 /* MPMoviePlayerController.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4C1677DA13C70F1A00814195 /* MPMoviePlayerController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1677D813C70F1900814195 /* MPMoviePlayerController.m */; }; 4C16781613C71E4900814195 /* MPMediaPlayback.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C16781513C71E4900814195 /* MPMediaPlayback.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4C16781A13C71E6200814195 /* UIInternalMovieView.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C16781813C71E6200814195 /* UIInternalMovieView.h */; settings = {ATTRIBUTES = (Private, ); }; }; 4C16781B13C71E6200814195 /* UIInternalMovieView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C16781913C71E6200814195 /* UIInternalMovieView.m */; }; 4C16787D13C71FB900814195 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C16787C13C71FB900814195 /* UIKit.framework */; }; 4C16789F13C7206500814195 /* QTKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C16789E13C7206500814195 /* QTKit.framework */; }; 4C72FDF613C746E800D3E453 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C72FDF513C746E800D3E453 /* QuartzCore.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ 4C16787913C71F8A00814195 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 4C16787213C71F8A00814195 /* UIKit.xcodeproj */; proxyType = 2; remoteGlobalIDString = 8DC2EF5B0486A6940098B216; remoteInfo = UIKit; }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ 0867D69BFE84028FC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 0867D6A5FE840307C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 14C25EF21211ED0400622309 /* MediaPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MediaPlayer.h; path = Classes/MediaPlayer.h; sourceTree = ""; }; 14C25EF41211ED0C00622309 /* MediaPlayer_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaPlayer_Prefix.pch; sourceTree = ""; }; 14C25EFE1211ED4C00622309 /* MPMusicPlayerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MPMusicPlayerController.h; path = Classes/MPMusicPlayerController.h; sourceTree = ""; }; 14C25EFF1211ED4C00622309 /* MPMusicPlayerController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MPMusicPlayerController.m; path = Classes/MPMusicPlayerController.m; sourceTree = ""; }; 14EFB1BA1211DB5300D19B0C /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; 4C1677D713C70F1900814195 /* MPMoviePlayerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MPMoviePlayerController.h; path = Classes/MPMoviePlayerController.h; sourceTree = ""; }; 4C1677D813C70F1900814195 /* MPMoviePlayerController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MPMoviePlayerController.m; path = Classes/MPMoviePlayerController.m; sourceTree = ""; }; 4C16781513C71E4900814195 /* MPMediaPlayback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MPMediaPlayback.h; path = Classes/MPMediaPlayback.h; sourceTree = ""; }; 4C16781813C71E6200814195 /* UIInternalMovieView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UIInternalMovieView.h; path = Classes/UIInternalMovieView.h; sourceTree = ""; }; 4C16781913C71E6200814195 /* UIInternalMovieView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = UIInternalMovieView.m; path = Classes/UIInternalMovieView.m; sourceTree = ""; }; 4C16787213C71F8A00814195 /* UIKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = UIKit.xcodeproj; path = ../UIKit/UIKit.xcodeproj; sourceTree = ""; }; 4C16787C13C71FB900814195 /* UIKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = UIKit.framework; sourceTree = SOURCE_ROOT; }; 4C16789E13C7206500814195 /* QTKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QTKit.framework; path = System/Library/Frameworks/QTKit.framework; sourceTree = SDKROOT; }; 4C72FDF513C746E800D3E453 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 8DC2EF5B0486A6940098B216 /* MediaPlayer.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MediaPlayer.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 8DC2EF560486A6940098B216 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 4C72FDF613C746E800D3E453 /* QuartzCore.framework in Frameworks */, 4C16789F13C7206500814195 /* QTKit.framework in Frameworks */, 4C16787D13C71FB900814195 /* UIKit.framework in Frameworks */, 14EFB1BB1211DB5300D19B0C /* Cocoa.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 034768DFFF38A50411DB9C8B /* Products */ = { isa = PBXGroup; children = ( 8DC2EF5B0486A6940098B216 /* MediaPlayer.framework */, ); name = Products; sourceTree = ""; }; 0867D691FE84028FC02AAC07 /* UIKit */ = { isa = PBXGroup; children = ( 4C72FDF513C746E800D3E453 /* QuartzCore.framework */, 4C16789E13C7206500814195 /* QTKit.framework */, 4C16787C13C71FB900814195 /* UIKit.framework */, 08FB77AEFE84172EC02AAC07 /* Classes */, 4C16780A13C71DDC00814195 /* Private Classes */, 089C1665FE841158C02AAC07 /* Resources */, 32C88DFF0371C24200C91783 /* Other Sources */, 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */, 034768DFFF38A50411DB9C8B /* Products */, 4C16787213C71F8A00814195 /* UIKit.xcodeproj */, ); name = UIKit; sourceTree = ""; }; 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = { isa = PBXGroup; children = ( 0867D6A5FE840307C02AAC07 /* AppKit.framework */, 0867D69BFE84028FC02AAC07 /* Foundation.framework */, 14EFB1BA1211DB5300D19B0C /* Cocoa.framework */, ); name = "External Frameworks and Libraries"; sourceTree = ""; }; 089C1665FE841158C02AAC07 /* Resources */ = { isa = PBXGroup; children = ( 8DC2EF5A0486A6940098B216 /* Info.plist */, ); name = Resources; sourceTree = ""; }; 08FB77AEFE84172EC02AAC07 /* Classes */ = { isa = PBXGroup; children = ( 14C25EF21211ED0400622309 /* MediaPlayer.h */, 14C25EFE1211ED4C00622309 /* MPMusicPlayerController.h */, 14C25EFF1211ED4C00622309 /* MPMusicPlayerController.m */, 4C1677D713C70F1900814195 /* MPMoviePlayerController.h */, 4C1677D813C70F1900814195 /* MPMoviePlayerController.m */, 4C16781513C71E4900814195 /* MPMediaPlayback.h */, ); name = Classes; sourceTree = ""; }; 32C88DFF0371C24200C91783 /* Other Sources */ = { isa = PBXGroup; children = ( 14C25EF41211ED0C00622309 /* MediaPlayer_Prefix.pch */, ); name = "Other Sources"; sourceTree = ""; }; 4C16780A13C71DDC00814195 /* Private Classes */ = { isa = PBXGroup; children = ( 4C16781813C71E6200814195 /* UIInternalMovieView.h */, 4C16781913C71E6200814195 /* UIInternalMovieView.m */, ); name = "Private Classes"; sourceTree = ""; }; 4C16787313C71F8A00814195 /* Products */ = { isa = PBXGroup; children = ( 4C16787A13C71F8A00814195 /* UIKit.framework */, ); name = Products; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ 8DC2EF500486A6940098B216 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( 14C25EF31211ED0400622309 /* MediaPlayer.h in Headers */, 14C25F001211ED4C00622309 /* MPMusicPlayerController.h in Headers */, 4C1677D913C70F1A00814195 /* MPMoviePlayerController.h in Headers */, 4C16781613C71E4900814195 /* MPMediaPlayback.h in Headers */, 4C16781A13C71E6200814195 /* UIInternalMovieView.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ 8DC2EF4F0486A6940098B216 /* MediaPlayer */ = { isa = PBXNativeTarget; buildConfigurationList = 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "MediaPlayer" */; buildPhases = ( 8DC2EF500486A6940098B216 /* Headers */, 8DC2EF520486A6940098B216 /* Resources */, 8DC2EF540486A6940098B216 /* Sources */, 8DC2EF560486A6940098B216 /* Frameworks */, ); buildRules = ( ); dependencies = ( ); name = MediaPlayer; productInstallPath = "$(HOME)/Library/Frameworks"; productName = UIKit; productReference = 8DC2EF5B0486A6940098B216 /* MediaPlayer.framework */; productType = "com.apple.product-type.framework"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 0867D690FE84028FC02AAC07 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0510; }; buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "MediaPlayer" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( English, Japanese, French, German, ); mainGroup = 0867D691FE84028FC02AAC07 /* UIKit */; productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; projectDirPath = ""; projectReferences = ( { ProductGroup = 4C16787313C71F8A00814195 /* Products */; ProjectRef = 4C16787213C71F8A00814195 /* UIKit.xcodeproj */; }, ); projectRoot = ""; targets = ( 8DC2EF4F0486A6940098B216 /* MediaPlayer */, ); }; /* End PBXProject section */ /* Begin PBXReferenceProxy section */ 4C16787A13C71F8A00814195 /* UIKit.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; path = UIKit.framework; remoteRef = 4C16787913C71F8A00814195 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXReferenceProxy section */ /* Begin PBXResourcesBuildPhase section */ 8DC2EF520486A6940098B216 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 8DC2EF540486A6940098B216 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 14C25F011211ED4C00622309 /* MPMusicPlayerController.m in Sources */, 4C1677DA13C70F1A00814195 /* MPMoviePlayerController.m in Sources */, 4C16781B13C71E6200814195 /* UIInternalMovieView.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin XCBuildConfiguration section */ 1DEB91AE08733DA50010E9CD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)\"", ); FRAMEWORK_VERSION = A; GCC_DYNAMIC_NO_PIC = NO; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = MediaPlayer_Prefix.pch; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; PRODUCT_NAME = MediaPlayer; SYMROOT = ../build; VALID_ARCHS = "i386 x86_64"; WRAPPER_EXTENSION = framework; }; name = Debug; }; 1DEB91AF08733DA50010E9CD /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)\"", ); FRAMEWORK_VERSION = A; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = MediaPlayer_Prefix.pch; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; PRODUCT_NAME = MediaPlayer; SYMROOT = ../build; VALID_ARCHS = "i386 x86_64"; WRAPPER_EXTENSION = framework; }; name = Release; }; 1DEB91B208733DA50010E9CD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.6; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; }; name = Debug; }; 1DEB91B308733DA50010E9CD /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = "3rd Party Mac Developer Application"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.6; PROVISIONING_PROFILE = ""; SDKROOT = macosx; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "MediaPlayer" */ = { isa = XCConfigurationList; buildConfigurations = ( 1DEB91AE08733DA50010E9CD /* Debug */, 1DEB91AF08733DA50010E9CD /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "MediaPlayer" */ = { isa = XCConfigurationList; buildConfigurations = ( 1DEB91B208733DA50010E9CD /* Debug */, 1DEB91B308733DA50010E9CD /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 0867D690FE84028FC02AAC07 /* Project object */; } ================================================ FILE: Examples/Chameleon Demo/Chameleon/MediaPlayer/MediaPlayer.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: Examples/Chameleon Demo/Chameleon/MediaPlayer/MediaPlayer_Prefix.pch ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifdef __OBJC__ #import #endif ================================================ FILE: Examples/Chameleon Demo/Chameleon/MessageUI/Classes/MFMailComposeViewController.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @class MFMailComposeViewController; enum MFMailComposeResult { MFMailComposeResultCancelled, MFMailComposeResultSaved, MFMailComposeResultSent, MFMailComposeResultFailed }; typedef enum MFMailComposeResult MFMailComposeResult; @protocol MFMailComposeViewControllerDelegate @optional - (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error; @end @interface MFMailComposeViewController : UINavigationController + (BOOL)canSendMail; - (void)setSubject:(NSString*)subject; - (void)setToRecipients:(NSArray*)toRecipients; - (void)setMessageBody:(NSString*)body isHTML:(BOOL)isHTML; - (void)setCcRecipients:(NSArray*)ccRecipients; - (void)setBccRecipients:(NSArray*)bccRecipients; - (void)addAttachmentData:(NSData*)attachment mimeType:(NSString*)mimeType fileName:(NSString*)filename; @property (nonatomic, assign) id mailComposeDelegate; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/MessageUI/Classes/MFMailComposeViewController.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "MFMailComposeViewController.h" @implementation MFMailComposeViewController + (BOOL)canSendMail { return NO; } - (void)setSubject:(NSString*)subject { } - (void)setToRecipients:(NSArray*)toRecipients { } - (void)setMessageBody:(NSString*)body isHTML:(BOOL)isHTML { } - (void)setCcRecipients:(NSArray*)ccRecipients { } - (void)setBccRecipients:(NSArray*)bccRecipients { } - (void)addAttachmentData:(NSData*)attachment mimeType:(NSString*)mimeType fileName:(NSString*)filename { } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/MessageUI/Classes/MessageUI.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "MFMailComposeViewController.h" #import "MFMessageComposeViewController.h" ================================================ FILE: Examples/Chameleon Demo/Chameleon/MessageUI/Info.plist ================================================ CFBundleDevelopmentRegion English CFBundleExecutable ${EXECUTABLE_NAME} CFBundleName ${PRODUCT_NAME} CFBundleIconFile CFBundleIdentifier org.chameleonproject.MessageUI CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType FMWK CFBundleSignature ???? CFBundleVersion 1 CFBundleShortVersionString 1.0 NSPrincipalClass ================================================ FILE: Examples/Chameleon Demo/Chameleon/MessageUI/MFMessageComposeViewController.h ================================================ // // MFMessageComposeViewController.h // MessageUI // // Created by Peter Steinberger on 24.03.11. // /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @protocol MFMessageComposeViewControllerDelegate; enum MessageComposeResult { MessageComposeResultCancelled, MessageComposeResultSent, MessageComposeResultFailed }; typedef enum MessageComposeResult MessageComposeResult; @interface MFMessageComposeViewController : NSObject + (BOOL)canSendText; @property (nonatomic, assign) id messageComposeDelegate; @property(nonatomic, copy) NSArray *recipients; @property(nonatomic, copy) NSString *body; @end @protocol MFMessageComposeViewControllerDelegate @required - (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/MessageUI/MFMessageComposeViewController.m ================================================ // // MFMessageComposeViewController.m // MessageUI // // Created by Peter Steinberger on 24.03.11. // /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "MFMessageComposeViewController.h" @implementation MFMessageComposeViewController + (BOOL)canSendText { return NO; // most likely we can't send messages on a mac ;) } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/MessageUI/MessageUI.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 143B578F1230357600F43562 /* MFMailComposeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 14FB132C12302FD900B615ED /* MFMailComposeViewController.m */; }; 143B57941230357C00F43562 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 14FB133A1230307C00B615ED /* UIKit.framework */; }; 14C25EF31211ED0400622309 /* MessageUI.h in Headers */ = {isa = PBXBuildFile; fileRef = 14C25EF21211ED0400622309 /* MessageUI.h */; settings = {ATTRIBUTES = (Public, ); }; }; 14EFB1BB1211DB5300D19B0C /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 14EFB1BA1211DB5300D19B0C /* Cocoa.framework */; }; 14FB132D12302FD900B615ED /* MFMailComposeViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 14FB132B12302FD900B615ED /* MFMailComposeViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; 78CB48DD133ABB2C008636DA /* MFMessageComposeViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 78CB48DB133ABB2C008636DA /* MFMessageComposeViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; 78CB48DE133ABB2C008636DA /* MFMessageComposeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 78CB48DC133ABB2C008636DA /* MFMessageComposeViewController.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ 14FB13391230307C00B615ED /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 14FB13351230307C00B615ED /* UIKit.xcodeproj */; proxyType = 2; remoteGlobalIDString = 8DC2EF5B0486A6940098B216; remoteInfo = UIKit; }; 14FB133C1230308E00B615ED /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 14FB13351230307C00B615ED /* UIKit.xcodeproj */; proxyType = 1; remoteGlobalIDString = 8DC2EF4F0486A6940098B216; remoteInfo = UIKit; }; 780E7544133AC53400D8C77B /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 780E7540133AC53400D8C77B /* UIKit.xcodeproj */; proxyType = 2; remoteGlobalIDString = 8DC2EF5B0486A6940098B216; remoteInfo = UIKit; }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ 0867D69BFE84028FC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 0867D6A5FE840307C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 14C25EF21211ED0400622309 /* MessageUI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MessageUI.h; path = Classes/MessageUI.h; sourceTree = ""; }; 14EFB1BA1211DB5300D19B0C /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; 14FB132512302F8700B615ED /* MessageUI_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageUI_Prefix.pch; sourceTree = ""; }; 14FB132B12302FD900B615ED /* MFMailComposeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MFMailComposeViewController.h; path = Classes/MFMailComposeViewController.h; sourceTree = ""; }; 14FB132C12302FD900B615ED /* MFMailComposeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MFMailComposeViewController.m; path = Classes/MFMailComposeViewController.m; sourceTree = ""; }; 14FB13351230307C00B615ED /* UIKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = UIKit.xcodeproj; path = ../UIKit/UIKit.xcodeproj; sourceTree = SOURCE_ROOT; }; 780E7540133AC53400D8C77B /* UIKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = UIKit.xcodeproj; path = ../UIKit/UIKit.xcodeproj; sourceTree = ""; }; 78CB48DB133ABB2C008636DA /* MFMessageComposeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MFMessageComposeViewController.h; sourceTree = ""; }; 78CB48DC133ABB2C008636DA /* MFMessageComposeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MFMessageComposeViewController.m; sourceTree = ""; }; 8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 8DC2EF5B0486A6940098B216 /* MessageUI.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MessageUI.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 8DC2EF560486A6940098B216 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 143B57941230357C00F43562 /* UIKit.framework in Frameworks */, 14EFB1BB1211DB5300D19B0C /* Cocoa.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 034768DFFF38A50411DB9C8B /* Products */ = { isa = PBXGroup; children = ( 8DC2EF5B0486A6940098B216 /* MessageUI.framework */, ); name = Products; sourceTree = ""; }; 0867D691FE84028FC02AAC07 /* UIKit */ = { isa = PBXGroup; children = ( 14FB13351230307C00B615ED /* UIKit.xcodeproj */, 08FB77AEFE84172EC02AAC07 /* Classes */, 089C1665FE841158C02AAC07 /* Resources */, 32C88DFF0371C24200C91783 /* Other Sources */, 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */, 034768DFFF38A50411DB9C8B /* Products */, 780E7540133AC53400D8C77B /* UIKit.xcodeproj */, ); name = UIKit; sourceTree = ""; }; 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = { isa = PBXGroup; children = ( 0867D6A5FE840307C02AAC07 /* AppKit.framework */, 0867D69BFE84028FC02AAC07 /* Foundation.framework */, 14EFB1BA1211DB5300D19B0C /* Cocoa.framework */, ); name = "External Frameworks and Libraries"; sourceTree = ""; }; 089C1665FE841158C02AAC07 /* Resources */ = { isa = PBXGroup; children = ( 8DC2EF5A0486A6940098B216 /* Info.plist */, ); name = Resources; sourceTree = ""; }; 08FB77AEFE84172EC02AAC07 /* Classes */ = { isa = PBXGroup; children = ( 14C25EF21211ED0400622309 /* MessageUI.h */, 14FB132B12302FD900B615ED /* MFMailComposeViewController.h */, 14FB132C12302FD900B615ED /* MFMailComposeViewController.m */, 78CB48DB133ABB2C008636DA /* MFMessageComposeViewController.h */, 78CB48DC133ABB2C008636DA /* MFMessageComposeViewController.m */, ); name = Classes; sourceTree = ""; }; 14FB13361230307C00B615ED /* Products */ = { isa = PBXGroup; children = ( 14FB133A1230307C00B615ED /* UIKit.framework */, ); name = Products; sourceTree = ""; }; 32C88DFF0371C24200C91783 /* Other Sources */ = { isa = PBXGroup; children = ( 14FB132512302F8700B615ED /* MessageUI_Prefix.pch */, ); name = "Other Sources"; sourceTree = ""; }; 780E7541133AC53400D8C77B /* Products */ = { isa = PBXGroup; children = ( 780E7545133AC53400D8C77B /* UIKit.framework */, ); name = Products; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ 8DC2EF500486A6940098B216 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( 14C25EF31211ED0400622309 /* MessageUI.h in Headers */, 14FB132D12302FD900B615ED /* MFMailComposeViewController.h in Headers */, 78CB48DD133ABB2C008636DA /* MFMessageComposeViewController.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ 8DC2EF4F0486A6940098B216 /* MessageUI */ = { isa = PBXNativeTarget; buildConfigurationList = 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "MessageUI" */; buildPhases = ( 8DC2EF500486A6940098B216 /* Headers */, 8DC2EF520486A6940098B216 /* Resources */, 8DC2EF540486A6940098B216 /* Sources */, 8DC2EF560486A6940098B216 /* Frameworks */, ); buildRules = ( ); dependencies = ( 14FB133D1230308E00B615ED /* PBXTargetDependency */, ); name = MessageUI; productInstallPath = "$(HOME)/Library/Frameworks"; productName = UIKit; productReference = 8DC2EF5B0486A6940098B216 /* MessageUI.framework */; productType = "com.apple.product-type.framework"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 0867D690FE84028FC02AAC07 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0510; }; buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "MessageUI" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( English, Japanese, French, German, ); mainGroup = 0867D691FE84028FC02AAC07 /* UIKit */; productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; projectDirPath = ""; projectReferences = ( { ProductGroup = 780E7541133AC53400D8C77B /* Products */; ProjectRef = 780E7540133AC53400D8C77B /* UIKit.xcodeproj */; }, { ProductGroup = 14FB13361230307C00B615ED /* Products */; ProjectRef = 14FB13351230307C00B615ED /* UIKit.xcodeproj */; }, ); projectRoot = ""; targets = ( 8DC2EF4F0486A6940098B216 /* MessageUI */, ); }; /* End PBXProject section */ /* Begin PBXReferenceProxy section */ 14FB133A1230307C00B615ED /* UIKit.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; path = UIKit.framework; remoteRef = 14FB13391230307C00B615ED /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; 780E7545133AC53400D8C77B /* UIKit.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; path = UIKit.framework; remoteRef = 780E7544133AC53400D8C77B /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXReferenceProxy section */ /* Begin PBXResourcesBuildPhase section */ 8DC2EF520486A6940098B216 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 8DC2EF540486A6940098B216 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 143B578F1230357600F43562 /* MFMailComposeViewController.m in Sources */, 78CB48DE133ABB2C008636DA /* MFMessageComposeViewController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ 14FB133D1230308E00B615ED /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = UIKit; targetProxy = 14FB133C1230308E00B615ED /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ 1DEB91AE08733DA50010E9CD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COMBINE_HIDPI_IMAGES = NO; COPY_PHASE_STRIP = NO; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; GCC_DYNAMIC_NO_PIC = NO; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = MessageUI_Prefix.pch; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; PRODUCT_NAME = MessageUI; SYMROOT = ../build; WRAPPER_EXTENSION = framework; }; name = Debug; }; 1DEB91AF08733DA50010E9CD /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COMBINE_HIDPI_IMAGES = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = MessageUI_Prefix.pch; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; PRODUCT_NAME = MessageUI; SYMROOT = ../build; WRAPPER_EXTENSION = framework; }; name = Release; }; 1DEB91B208733DA50010E9CD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.7; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; }; name = Debug; }; 1DEB91B308733DA50010E9CD /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = "Developer ID Application: The Iconfactory"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.7; PROVISIONING_PROFILE = ""; SDKROOT = macosx; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "MessageUI" */ = { isa = XCConfigurationList; buildConfigurations = ( 1DEB91AE08733DA50010E9CD /* Debug */, 1DEB91AF08733DA50010E9CD /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "MessageUI" */ = { isa = XCConfigurationList; buildConfigurations = ( 1DEB91B208733DA50010E9CD /* Debug */, 1DEB91B308733DA50010E9CD /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 0867D690FE84028FC02AAC07 /* Project object */; } ================================================ FILE: Examples/Chameleon Demo/Chameleon/MessageUI/MessageUI.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: Examples/Chameleon Demo/Chameleon/MessageUI/MessageUI_Prefix.pch ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifdef __OBJC__ #import #endif ================================================ FILE: Examples/Chameleon Demo/Chameleon/README.md ================================================ # Chameleon Chameleon is a port of Apple's UIKit (and some minimal related frameworks) to Mac OS X. It is meant to be as much of a drop-in replacement for the real UIKit as possible. It also adapts some iOS user interface conventions to the Mac (such as UIAlertView being represented by NSAlert) so that apps built using Chameleon have as much chance as possible of feeling at home on the desktop with relatively little porting effort. Chameleon requires OS X 10.6 or higher. Apps built with it have been proven to be acceptable to Apple for the Mac App Store. Chameleon was first built by [The Iconfactory](http://iconfactory.com/) to unify the codebase of [Twitterrific](http://www.twitterrific.com/) for both Mac and iOS. The UIKit implementation mostly targets iOS 3.2's version of UIKit. Not everything is implemented at this time, but a surprisingly large subset is. There are some methods and/or behaviors from later versions of iOS implemented as well. Any UIKit methods that were deprecated around iOS 3.2 are not included. As a general rule, if Apple's UIKit behaves in a certain way for some piece of code, that behavior should be considered correct even if you don't like how Apple's version does things. If Chameleon's behavior differs, Chameleon is wrong. That said, before immediately blaming problems on Chameleon, be absolutely sure that your code is, in fact, behaving differently than it would on Apple's implementation. Also be certain that there isn't a good reason Chameleon's behavior may differ. (An example of a difference that is intended is the behavior of UIAlertView - in Apple's UIKit, it is a UIView and has certain expected behaviors and capabilities as a result. In Chameleon, it is still a UIView, but it is presented as an NSAlert and that is simply how it should be to achieve a more native feel but it also means any UIView tricks that may have worked with a UIAlertView on iOS will not work the same under Chameleon. UIActionSheet and UITextView are other examples of areas that have sometimes large but intentional differences.) ## Usage Chameleon is actually a collection of several frameworks, the largest of which is UIKit. The others are mostly stubs that made porting simple demos and test apps from iOS very simple with minimal (in some cases, zero) code changes and may or may not be necessary for you. The Xcode projects build embeddable frameworks which can then be bundled within your own app's bundle and distributed in a self-contained way. ## Design The UIKit port in Chameleon starts at a very low level and attempts to go so far as to even route UIEvent objects along a similar path starting in the single UIApplication instance and getting routed from there to the correct UIWindows and UIViews. The interface between AppKit's NSViews and NSWindows and Chameleon's UIWindow and UIViews occurs at the "screen" level. UIKitView is an NSView which you add to your NSView hierarchy in whatever way you want. The UIKitView hosts a UIScreen instance which is home to UIKit's interface elements. Each UIWindow belongs to a UIScreen, and UIViews must exist on UIWindows. This should mostly work the same as you've come to expect on iOS. An important thing to note is that Mac applications often have more than one window. If you use more than one UIKitView in your app, be aware that this means your application now has more than one UIScreen and as a result some methods such as [UIScreen mainScreen] may suddenly do unexpected things. When porting Twitterrific from iOS, this was one source of unexpected bugs as a few things were making assumptions about there only being a single, main screen since that is normal on current iOS devices. Once a UIKitView exists and there's a UIScreen available to work with, your code can proceed to build a UIWindow and UIViews on top of it and be largely unaware that it is actually running on OSX instead of iOS. For those cases where you need to customize some UI, `UIUserInterfaceIdiomDesktop` has been added so that your code can differentiate between running on a pad, phone, or desktop in a consistent way. To keep code cross platform, the following is a good way to structure things so that Apple's UIKit doesn't encounter the unknown `UIUserInterfaceIdiomDesktop` symbol when compiling for iOS: if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { // iPhone } else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { // iPad } else { // Mac } (You can always use #ifdef or other compile-time approaches for platform differentiation, too - especially since a Mac app built with Chameleon doesn't need to adapt to multiple UI idioms at runtime the way a universal iOS app does. I just find it nice to have a similar pattern for all 3 idioms - but maybe that's just me.) You can usually just create an instance of your iOS app's UIApplicationDelegate object and then pass it into UIKitView's helper method `-launchApplicationWithDelegate:afterDelay:` which will emulate the startup process of an iOS app (it will even attempt to show a Default.png if a delay is given). You might perform this step in your NSApplicationDelegate object's `-applicationDidFinishLaunching:` method. It is not necessary to use UIKitView's helper method to "launch" your app, but it can be a good way to get started. Generally the interfaces to the classes are the same as Apple's documented interfaces. Some objects have additional methods that are useful for OS X and are defined in `(ClassName)AppKitIntegration.h` headers which are not included by the standard `UIKit.h` header. To easily include all AppKit extensions into your code, import `UIKit/AppKitIntegration.h` when compiling on OS X. There are also a couple of non-standard UI classes defined such as UIKey and UIViewAdapter that I designed out of necessity. (Keyboard handling in particular is a weak spot of Apple's current UIKit and so I developed my own rough API in place of anything "official" being documented by Apple.) ## Examples Right now there's hardly any demos or examples or documentation. There's a simple app called BigApple in the Examples folder which might be enough to get started. It also shows how the UIKit Xcode project can be referenced from another Xcode project and setup as a dependency so that it is built automatically when the BigApple project is built. ## Authors The Chameleon project was created by Sean Heber (Twitter: [@BigZaphod](http://twitter.com/BigZaphod/)) of The Iconfactory and he wrote nearly all of the initial version over several months. Craig Hockenberry (Twitter: [@chockenberry](http://twitter.com/chockenberry/)) was the first user/tester of Chameleon and found many holes and edge cases in the first implementation. ## License Copyright (c) 2011, The Iconfactory. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of The Iconfactory nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================ FILE: Examples/Chameleon Demo/Chameleon/StoreKit/Classes/SKPayment.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @interface SKPayment : NSObject { } + (id)paymentWithProductIdentifier:(NSString *)identifier; @property (nonatomic, readonly) NSString *productIdentifier; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/StoreKit/Classes/SKPayment.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "SKPayment.h" @implementation SKPayment + (id)paymentWithProductIdentifier:(NSString *)identifier { return nil; } - (NSString *)productIdentifier { return nil; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/StoreKit/Classes/SKPaymentQueue.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @class SKPayment, SKPaymentTransaction; @protocol SKPaymentTransactionObserver @end @interface SKPaymentQueue : NSObject { } + (BOOL)canMakePayments; + (SKPaymentQueue *)defaultQueue; - (void)addTransactionObserver:(id)observer; - (void)removeTransactionObserver:(id)observer; - (void)addPayment:(SKPayment *)payment; - (void)finishTransaction:(SKPaymentTransaction *)transaction; - (void)restoreCompletedTransactions; @property(nonatomic, readonly) NSArray *transactions; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/StoreKit/Classes/SKPaymentQueue.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "SKPaymentQueue.h" @implementation SKPaymentQueue + (BOOL)canMakePayments { return NO; } + (SKPaymentQueue *)defaultQueue { return nil; } - (void)addTransactionObserver:(id)observer { } - (void)removeTransactionObserver:(id)observer { } - (void)addPayment:(SKPayment *)payment { } - (void)finishTransaction:(SKPaymentTransaction *)transaction { } - (void)restoreCompletedTransactions { } - (NSArray *)transactions { return nil; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/StoreKit/Classes/SKPaymentTransaction.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @class SKPayment, SKPaymentTransaction; enum { SKPaymentTransactionStatePurchasing, SKPaymentTransactionStatePurchased, SKPaymentTransactionStateFailed, SKPaymentTransactionStateRestored }; typedef NSInteger SKPaymentTransactionState; @interface SKPaymentTransaction : NSObject { } @property (nonatomic, readonly) NSError *error; @property (nonatomic, readonly) SKPayment *payment; @property (nonatomic, readonly) SKPaymentTransactionState transactionState; @property (nonatomic, readonly) NSString *transactionIdentifier; @property (nonatomic, readonly) NSData *transactionReceipt; @property (nonatomic, readonly) NSDate *transactionDate; @property (nonatomic, readonly) SKPaymentTransaction *originalTransaction; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/StoreKit/Classes/SKPaymentTransaction.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "SKPaymentTransaction.h" @implementation SKPaymentTransaction - (NSError *)error { return nil; } - (SKPayment *)payment { return nil; } - (SKPaymentTransactionState)transactionState { return SKPaymentTransactionStateFailed; } - (NSString *)transactionIdentifier { return nil; } - (NSData *)transactionReceipt { return nil; } - (NSDate *)transactionDate { return nil; } - (SKPaymentTransaction *)originalTransaction { return nil; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/StoreKit/Classes/SKProduct.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @interface SKProduct : NSObject { } @property (nonatomic, readonly) NSString *productIdentifier; @property (nonatomic, readonly) NSString *localizedTitle; @property (nonatomic, readonly) NSString *localizedDescription; @property (nonatomic, readonly) NSDecimalNumber *price; @property (nonatomic, readonly) NSLocale *priceLocale; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/StoreKit/Classes/SKProduct.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "SKProduct.h" @implementation SKProduct - (NSString *)productIdentifier { return nil; } - (NSString *)localizedTitle; { return nil; } - (NSString *)localizedDescription; { return nil; } - (NSDecimalNumber *)price; { return nil; } - (NSLocale *)priceLocale { return nil; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/StoreKit/Classes/SKProductsRequest.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "SKRequest.h" @protocol SKProductsRequestDelegate @end @interface SKProductsRequest : SKRequest { } - (id)initWithProductIdentifiers:(NSSet *)productIdentifiers; - (void)start; - (void)cancel; @property(nonatomic, assign) id delegate; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/StoreKit/Classes/SKProductsRequest.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "SKProductsRequest.h" @implementation SKProductsRequest @dynamic delegate; - (id)initWithProductIdentifiers:(NSSet *)productIdentifiers { if ((self=[super init])) { } return self; } - (void)start { } - (void)cancel { } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/StoreKit/Classes/SKProductsResponse.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @interface SKProductsResponse : NSObject { } @property (nonatomic, readonly) NSArray *products; @property (nonatomic, readonly) NSArray *invalidProductIdentifiers; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/StoreKit/Classes/SKProductsResponse.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "SKProductsResponse.h" @implementation SKProductsResponse - (NSArray *)products { return nil; } - (NSArray *)invalidProductIdentifiers { return nil; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/StoreKit/Classes/SKRequest.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @protocol SKRequestDelegate @end @interface SKRequest : NSObject { @private __unsafe_unretained id _delegate; } @property(nonatomic, assign) id delegate; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/StoreKit/Classes/SKRequest.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "SKRequest.h" @implementation SKRequest @synthesize delegate=_delegate; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/StoreKit/Classes/StoreKit.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ enum { SKErrorUnknown, SKErrorClientInvalid, SKErrorPaymentCancelled, SKErrorPaymentInvalid, SKErrorPaymentNotAllowed }; #import "SKProduct.h" #import "SKRequest.h" #import "SKProductsRequest.h" #import "SKPaymentQueue.h" #import "SKPayment.h" #import "SKPaymentTransaction.h" #import "SKProductsResponse.h" ================================================ FILE: Examples/Chameleon Demo/Chameleon/StoreKit/Info.plist ================================================ CFBundleDevelopmentRegion English CFBundleExecutable ${EXECUTABLE_NAME} CFBundleName ${PRODUCT_NAME} CFBundleIconFile CFBundleIdentifier org.chameleonproject.StoreKit CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType FMWK CFBundleSignature ???? CFBundleVersion 1 CFBundleShortVersionString 1.0 NSPrincipalClass ================================================ FILE: Examples/Chameleon Demo/Chameleon/StoreKit/StoreKit.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 1436CFFB12147A91001DFEFB /* SKProduct.h in Headers */ = {isa = PBXBuildFile; fileRef = 1436CFF612147A91001DFEFB /* SKProduct.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1436CFFC12147A91001DFEFB /* SKProduct.m in Sources */ = {isa = PBXBuildFile; fileRef = 1436CFF712147A91001DFEFB /* SKProduct.m */; }; 1436CFFD12147A91001DFEFB /* SKRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 1436CFF812147A91001DFEFB /* SKRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1436CFFE12147A91001DFEFB /* SKRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 1436CFF912147A91001DFEFB /* SKRequest.m */; }; 1436CFFF12147A91001DFEFB /* StoreKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 1436CFFA12147A91001DFEFB /* StoreKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1436D00212147ABE001DFEFB /* SKProductsRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 1436D00012147ABE001DFEFB /* SKProductsRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1436D00312147ABE001DFEFB /* SKProductsRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 1436D00112147ABE001DFEFB /* SKProductsRequest.m */; }; 1436D00E12147B21001DFEFB /* SKPaymentQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 1436D00C12147B21001DFEFB /* SKPaymentQueue.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1436D00F12147B21001DFEFB /* SKPaymentQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 1436D00D12147B21001DFEFB /* SKPaymentQueue.m */; }; 1436D04712147C74001DFEFB /* SKPayment.h in Headers */ = {isa = PBXBuildFile; fileRef = 1436D04512147C74001DFEFB /* SKPayment.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1436D04812147C74001DFEFB /* SKPayment.m in Sources */ = {isa = PBXBuildFile; fileRef = 1436D04612147C74001DFEFB /* SKPayment.m */; }; 1436D05912147D11001DFEFB /* SKPaymentTransaction.h in Headers */ = {isa = PBXBuildFile; fileRef = 1436D05712147D11001DFEFB /* SKPaymentTransaction.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1436D05A12147D11001DFEFB /* SKPaymentTransaction.m in Sources */ = {isa = PBXBuildFile; fileRef = 1436D05812147D11001DFEFB /* SKPaymentTransaction.m */; }; 1436D07312147E51001DFEFB /* SKProductsResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 1436D07112147E51001DFEFB /* SKProductsResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1436D07412147E51001DFEFB /* SKProductsResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 1436D07212147E51001DFEFB /* SKProductsResponse.m */; }; 14EFB1BB1211DB5300D19B0C /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 14EFB1BA1211DB5300D19B0C /* Cocoa.framework */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 0867D69BFE84028FC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 0867D6A5FE840307C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 1436CFC912147935001DFEFB /* StoreKit_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StoreKit_Prefix.pch; sourceTree = ""; }; 1436CFF612147A91001DFEFB /* SKProduct.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SKProduct.h; sourceTree = ""; }; 1436CFF712147A91001DFEFB /* SKProduct.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SKProduct.m; sourceTree = ""; }; 1436CFF812147A91001DFEFB /* SKRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SKRequest.h; sourceTree = ""; }; 1436CFF912147A91001DFEFB /* SKRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SKRequest.m; sourceTree = ""; }; 1436CFFA12147A91001DFEFB /* StoreKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StoreKit.h; sourceTree = ""; }; 1436D00012147ABE001DFEFB /* SKProductsRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SKProductsRequest.h; sourceTree = ""; }; 1436D00112147ABE001DFEFB /* SKProductsRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SKProductsRequest.m; sourceTree = ""; }; 1436D00C12147B21001DFEFB /* SKPaymentQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SKPaymentQueue.h; sourceTree = ""; }; 1436D00D12147B21001DFEFB /* SKPaymentQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SKPaymentQueue.m; sourceTree = ""; }; 1436D04512147C74001DFEFB /* SKPayment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SKPayment.h; sourceTree = ""; }; 1436D04612147C74001DFEFB /* SKPayment.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SKPayment.m; sourceTree = ""; }; 1436D05712147D11001DFEFB /* SKPaymentTransaction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SKPaymentTransaction.h; sourceTree = ""; }; 1436D05812147D11001DFEFB /* SKPaymentTransaction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SKPaymentTransaction.m; sourceTree = ""; }; 1436D07112147E51001DFEFB /* SKProductsResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SKProductsResponse.h; sourceTree = ""; }; 1436D07212147E51001DFEFB /* SKProductsResponse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SKProductsResponse.m; sourceTree = ""; }; 14EFB1BA1211DB5300D19B0C /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; 8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 8DC2EF5B0486A6940098B216 /* StoreKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = StoreKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 8DC2EF560486A6940098B216 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 14EFB1BB1211DB5300D19B0C /* Cocoa.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 034768DFFF38A50411DB9C8B /* Products */ = { isa = PBXGroup; children = ( 8DC2EF5B0486A6940098B216 /* StoreKit.framework */, ); name = Products; sourceTree = ""; }; 0867D691FE84028FC02AAC07 /* UIKit */ = { isa = PBXGroup; children = ( 08FB77AEFE84172EC02AAC07 /* Classes */, 089C1665FE841158C02AAC07 /* Resources */, 32C88DFF0371C24200C91783 /* Other Sources */, 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */, 034768DFFF38A50411DB9C8B /* Products */, ); name = UIKit; sourceTree = ""; }; 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = { isa = PBXGroup; children = ( 0867D6A5FE840307C02AAC07 /* AppKit.framework */, 0867D69BFE84028FC02AAC07 /* Foundation.framework */, 14EFB1BA1211DB5300D19B0C /* Cocoa.framework */, ); name = "External Frameworks and Libraries"; sourceTree = ""; }; 089C1665FE841158C02AAC07 /* Resources */ = { isa = PBXGroup; children = ( 8DC2EF5A0486A6940098B216 /* Info.plist */, ); name = Resources; sourceTree = ""; }; 08FB77AEFE84172EC02AAC07 /* Classes */ = { isa = PBXGroup; children = ( 1436CFF612147A91001DFEFB /* SKProduct.h */, 1436CFF712147A91001DFEFB /* SKProduct.m */, 1436CFF812147A91001DFEFB /* SKRequest.h */, 1436CFF912147A91001DFEFB /* SKRequest.m */, 1436CFFA12147A91001DFEFB /* StoreKit.h */, 1436D00012147ABE001DFEFB /* SKProductsRequest.h */, 1436D00112147ABE001DFEFB /* SKProductsRequest.m */, 1436D00C12147B21001DFEFB /* SKPaymentQueue.h */, 1436D00D12147B21001DFEFB /* SKPaymentQueue.m */, 1436D04512147C74001DFEFB /* SKPayment.h */, 1436D04612147C74001DFEFB /* SKPayment.m */, 1436D05712147D11001DFEFB /* SKPaymentTransaction.h */, 1436D05812147D11001DFEFB /* SKPaymentTransaction.m */, 1436D07112147E51001DFEFB /* SKProductsResponse.h */, 1436D07212147E51001DFEFB /* SKProductsResponse.m */, ); path = Classes; sourceTree = ""; }; 32C88DFF0371C24200C91783 /* Other Sources */ = { isa = PBXGroup; children = ( 1436CFC912147935001DFEFB /* StoreKit_Prefix.pch */, ); name = "Other Sources"; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ 8DC2EF500486A6940098B216 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( 1436CFFF12147A91001DFEFB /* StoreKit.h in Headers */, 1436CFFB12147A91001DFEFB /* SKProduct.h in Headers */, 1436CFFD12147A91001DFEFB /* SKRequest.h in Headers */, 1436D00212147ABE001DFEFB /* SKProductsRequest.h in Headers */, 1436D00E12147B21001DFEFB /* SKPaymentQueue.h in Headers */, 1436D04712147C74001DFEFB /* SKPayment.h in Headers */, 1436D05912147D11001DFEFB /* SKPaymentTransaction.h in Headers */, 1436D07312147E51001DFEFB /* SKProductsResponse.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ 8DC2EF4F0486A6940098B216 /* StoreKit */ = { isa = PBXNativeTarget; buildConfigurationList = 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "StoreKit" */; buildPhases = ( 8DC2EF500486A6940098B216 /* Headers */, 8DC2EF520486A6940098B216 /* Resources */, 8DC2EF540486A6940098B216 /* Sources */, 8DC2EF560486A6940098B216 /* Frameworks */, ); buildRules = ( ); dependencies = ( ); name = StoreKit; productInstallPath = "$(HOME)/Library/Frameworks"; productName = UIKit; productReference = 8DC2EF5B0486A6940098B216 /* StoreKit.framework */; productType = "com.apple.product-type.framework"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 0867D690FE84028FC02AAC07 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0500; }; buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "StoreKit" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( English, Japanese, French, German, ); mainGroup = 0867D691FE84028FC02AAC07 /* UIKit */; productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 8DC2EF4F0486A6940098B216 /* StoreKit */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 8DC2EF520486A6940098B216 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 8DC2EF540486A6940098B216 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 1436CFFC12147A91001DFEFB /* SKProduct.m in Sources */, 1436CFFE12147A91001DFEFB /* SKRequest.m in Sources */, 1436D00312147ABE001DFEFB /* SKProductsRequest.m in Sources */, 1436D00F12147B21001DFEFB /* SKPaymentQueue.m in Sources */, 1436D04812147C74001DFEFB /* SKPayment.m in Sources */, 1436D05A12147D11001DFEFB /* SKPaymentTransaction.m in Sources */, 1436D07412147E51001DFEFB /* SKProductsResponse.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin XCBuildConfiguration section */ 1DEB91AE08733DA50010E9CD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; GCC_DYNAMIC_NO_PIC = NO; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = StoreKit_Prefix.pch; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; PRODUCT_NAME = StoreKit; SYMROOT = ../build; VALID_ARCHS = "i386 x86_64"; WRAPPER_EXTENSION = framework; }; name = Debug; }; 1DEB91AF08733DA50010E9CD /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = StoreKit_Prefix.pch; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; PRODUCT_NAME = StoreKit; SYMROOT = ../build; VALID_ARCHS = "i386 x86_64"; WRAPPER_EXTENSION = framework; }; name = Release; }; 1DEB91B208733DA50010E9CD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.7; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; }; name = Debug; }; 1DEB91B308733DA50010E9CD /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = "Developer ID Application: The Iconfactory"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.7; PROVISIONING_PROFILE = ""; SDKROOT = macosx; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "StoreKit" */ = { isa = XCConfigurationList; buildConfigurations = ( 1DEB91AE08733DA50010E9CD /* Debug */, 1DEB91AF08733DA50010E9CD /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "StoreKit" */ = { isa = XCConfigurationList; buildConfigurations = ( 1DEB91B208733DA50010E9CD /* Debug */, 1DEB91B308733DA50010E9CD /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 0867D690FE84028FC02AAC07 /* Project object */; } ================================================ FILE: Examples/Chameleon Demo/Chameleon/StoreKit/StoreKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: Examples/Chameleon Demo/Chameleon/StoreKit/StoreKit_Prefix.pch ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifdef __OBJC__ #import #endif ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/.gitignore ================================================ .DS_Store *.xcodeproj/*.pbxuser *.xcodeproj/*.perspectivev3 *.xcodeproj/xcuserdata *.xcodeproj/project.xcworkspace/xcuserdata ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/AppKitIntegration.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIColorAppKitIntegration.h" #import "UIFontAppKitIntegration.h" #import "UIImageAppKitIntegration.h" #import "UIResponderAppKitIntegration.h" #import "UIScreenAppKitIntegration.h" #import "UIActionSheetAppKitIntegration.h" #import "UIApplicationAppKitIntegration.h" ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/NSIndexPath+UITableView.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @interface NSIndexPath (UITableView) + (NSIndexPath *)indexPathForRow:(NSUInteger)row inSection:(NSUInteger)section; @property (readonly) NSUInteger row; @property (readonly) NSUInteger section; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/NSIndexPath+UITableView.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "NSIndexPath+UITableView.h" @implementation NSIndexPath (UITableView) + (NSIndexPath *)indexPathForRow:(NSUInteger)row inSection:(NSUInteger)section { NSUInteger path[2] = {section, row}; return [self indexPathWithIndexes:path length:2]; } - (NSUInteger)row { return [self indexAtPosition:1]; } -(NSUInteger)section { return [self indexAtPosition:0]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIAcceleration.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import typedef double UIAccelerationValue; @interface UIAcceleration : NSObject { UIAccelerationValue _x; UIAccelerationValue _y; UIAccelerationValue _z; NSTimeInterval _timestamp; } @property (nonatomic, readonly) UIAccelerationValue x; @property (nonatomic, readonly) UIAccelerationValue y; @property (nonatomic, readonly) UIAccelerationValue z; @property (nonatomic, readonly) NSTimeInterval timestamp; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIAcceleration.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIAcceleration.h" @implementation UIAcceleration @synthesize x=_x, y=_y, z=_z, timestamp=_timestamp; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIAccelerometer.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @class UIAccelerometer, UIAcceleration; @protocol UIAccelerometerDelegate - (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration; @end @interface UIAccelerometer : NSObject { @private NSTimeInterval _updateInterval; __unsafe_unretained id _delegate; } + (UIAccelerometer *)sharedAccelerometer; @property (nonatomic, assign) id delegate; @property (nonatomic) NSTimeInterval updateInterval; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIAccelerometer.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIAccelerometer.h" @implementation UIAccelerometer @synthesize updateInterval=_updateInterval, delegate=_delegate; + (UIAccelerometer *)sharedAccelerometer { return nil; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIAccessibility.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import typedef uint64_t UIAccessibilityTraits; extern UIAccessibilityTraits UIAccessibilityTraitNone; extern UIAccessibilityTraits UIAccessibilityTraitButton; extern UIAccessibilityTraits UIAccessibilityTraitLink; extern UIAccessibilityTraits UIAccessibilityTraitSearchField; extern UIAccessibilityTraits UIAccessibilityTraitImage; extern UIAccessibilityTraits UIAccessibilityTraitSelected; extern UIAccessibilityTraits UIAccessibilityTraitPlaysSound; extern UIAccessibilityTraits UIAccessibilityTraitKeyboardKey; extern UIAccessibilityTraits UIAccessibilityTraitStaticText; extern UIAccessibilityTraits UIAccessibilityTraitSummaryElement; extern UIAccessibilityTraits UIAccessibilityTraitNotEnabled; extern UIAccessibilityTraits UIAccessibilityTraitUpdatesFrequently; extern UIAccessibilityTraits UIAccessibilityTraitHeader; extern UIAccessibilityTraits UIAccessibilityTraitAllowsDirectInteraction; typedef uint32_t UIAccessibilityNotifications; extern UIAccessibilityNotifications UIAccessibilityScreenChangedNotification; extern UIAccessibilityNotifications UIAccessibilityLayoutChangedNotification; extern UIAccessibilityNotifications UIAccessibilityAnnouncementNotification; extern UIAccessibilityNotifications UIAccessibilityPageScrolledNotification; @interface NSObject (UIAccessibility) @property (nonatomic) BOOL isAccessibilityElement; @property (nonatomic) NSString *accessibilityLabel; @property (nonatomic) NSString *accessibilityHint; @property (nonatomic) NSString *accessibilityValue; @property (nonatomic) UIAccessibilityTraits accessibilityTraits; @property (nonatomic) CGRect accessibilityFrame; @property (nonatomic) BOOL accessibilityViewIsModal; @property (nonatomic) BOOL accessibilityElementsHidden; @end @interface NSObject (UIAccessibilityContainer) - (NSInteger)accessibilityElementCount; - (id)accessibilityElementAtIndex:(NSInteger)index; - (NSInteger)indexOfAccessibilityElement:(id)element; @end @interface NSObject (UIAccessibilityFocus) - (void)accessibilityElementDidBecomeFocused; - (void)accessibilityElementDidLoseFocus; - (BOOL)accessibilityElementIsFocused; @end extern void UIAccessibilityPostNotification(UIAccessibilityNotifications notification, id argument); extern BOOL UIAccessibilityIsVoiceOverRunning(void); ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIAccessibility.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIAccessibility.h" UIAccessibilityTraits UIAccessibilityTraitNone = 0; UIAccessibilityTraits UIAccessibilityTraitButton = 1; UIAccessibilityTraits UIAccessibilityTraitLink = 2; UIAccessibilityTraits UIAccessibilityTraitImage = 4; UIAccessibilityTraits UIAccessibilityTraitSelected = 8; UIAccessibilityTraits UIAccessibilityTraitPlaysSound = 16; UIAccessibilityTraits UIAccessibilityTraitKeyboardKey = 32; UIAccessibilityTraits UIAccessibilityTraitStaticText = 64; UIAccessibilityTraits UIAccessibilityTraitSummaryElement = 128; UIAccessibilityTraits UIAccessibilityTraitNotEnabled = 256; UIAccessibilityTraits UIAccessibilityTraitUpdatesFrequently = 512; UIAccessibilityTraits UIAccessibilityTraitSearchField = 1024; UIAccessibilityTraits UIAccessibilityTraitHeader = 2048; UIAccessibilityTraits UIAccessibilityTraitAllowsDirectInteraction = 8192; UIAccessibilityNotifications UIAccessibilityScreenChangedNotification = 1000; UIAccessibilityNotifications UIAccessibilityLayoutChangedNotification = 1001; UIAccessibilityNotifications UIAccessibilityAnnouncementNotification = 1002; UIAccessibilityNotifications UIAccessibilityPageScrolledNotification = 1003; @implementation NSObject (UIAccessibility) - (BOOL)isAccessibilityElement { return NO; } - (void)setIsAccessibilityElement:(BOOL)isElement { } - (NSString *)accessibilityLabel { return nil; } - (void)setAccessibilityLabel:(NSString *)label { } - (NSString *)accessibilityHint { return nil; } - (void)setAccessibilityHint:(NSString *)hint { } - (NSString *)accessibilityValue { return nil; } - (void)setAccessibilityValue:(NSString *)value { } - (UIAccessibilityTraits)accessibilityTraits { return UIAccessibilityTraitNone; // STUB } - (void)setAccessibilityTraits:(UIAccessibilityTraits)traits { } - (CGRect)accessibilityFrame { return CGRectNull; } - (void)setAccessibilityFrame:(CGRect)frame { } - (BOOL)accessibilityViewIsModal { return NO; } - (void)setAccessibilityViewIsModal:(BOOL)isModal { } - (BOOL)accessibilityElementsHidden { return NO; } - (void)setAccessibilityElementsHidden:(BOOL)accessibilityElementsHidden { } @end @implementation NSObject (UIAccessibilityContainer) - (NSInteger)accessibilityElementCount { return 0; } - (id)accessibilityElementAtIndex:(NSInteger)index { return nil; } - (NSInteger)indexOfAccessibilityElement:(id)element { return NSNotFound; } @end @implementation NSObject (UIAccessibilityFocus) - (void)accessibilityElementDidBecomeFocused { } - (void)accessibilityElementDidLoseFocus { } - (BOOL)accessibilityElementIsFocused { return NO; } @end void UIAccessibilityPostNotification(UIAccessibilityNotifications notification, id argument) { } BOOL UIAccessibilityIsVoiceOverRunning() { return NO; } ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIAccessibilityElement.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIAccessibility.h" @interface UIAccessibilityElement : NSObject { NSString *_accessibilityLabel; NSString *_accessibilityHint; NSString *_accessibilityValue; CGRect _accessibilityFrame; UIAccessibilityTraits _accessibilityTraits; } - (id)initWithAccessibilityContainer:(id)container; @property (nonatomic, strong) NSString *accessibilityLabel; @property (nonatomic, strong) NSString *accessibilityHint; @property (nonatomic, strong) NSString *accessibilityValue; @property (nonatomic, assign) CGRect accessibilityFrame; @property (nonatomic, assign) UIAccessibilityTraits accessibilityTraits; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIAccessibilityElement.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIAccessibilityElement.h" @implementation UIAccessibilityElement @synthesize accessibilityLabel=_accessibilityLabel, accessibilityHint=_accessibilityHint, accessibilityValue=_accessibilityValue; @synthesize accessibilityFrame=_accessibilityFrame, accessibilityTraits=_accessibilityTraits; - (id)initWithAccessibilityContainer:(id)container { if ((self=[super init])) { } return self; } - (void)dealloc { [_accessibilityLabel release]; [_accessibilityHint release]; [_accessibilityValue release]; [super dealloc]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIAction.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @interface UIAction : NSObject { __unsafe_unretained id _target; SEL _action; } @property (nonatomic, assign) id target; @property (nonatomic, assign) SEL action; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIAction.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIAction.h" @implementation UIAction @synthesize target=_target, action=_action; - (BOOL)isEqual:(id)object { if (object == self) { return YES; } else if ([object isKindOfClass:[self class]]) { return ([object target] == self.target && [object action] == self.action); } else { return NO; } } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIActionSheet.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIView.h" #import "UIInterface.h" @class UIActionSheet, UITabBar, UIToolbar, UIBarButtonItem; @protocol UIActionSheetDelegate @optional - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex; - (void)willPresentActionSheet:(UIActionSheet *)actionSheet; - (void)didPresentActionSheet:(UIActionSheet *)actionSheet; - (void)actionSheet:(UIActionSheet *)actionSheet willDismissWithButtonIndex:(NSInteger)buttonIndex; - (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex; - (void)actionSheetCancel:(UIActionSheet *)actionSheet; @end typedef enum { UIActionSheetStyleAutomatic = -1, UIActionSheetStyleDefault = UIBarStyleDefault, UIActionSheetStyleBlackTranslucent = UIBarStyleBlackTranslucent, UIActionSheetStyleBlackOpaque = UIBarStyleBlackOpaque, } UIActionSheetStyle; @interface UIActionSheet : UIView { @private __unsafe_unretained id _delegate; NSInteger _destructiveButtonIndex; NSInteger _cancelButtonIndex; NSInteger _firstOtherButtonIndex; NSString *_title; NSMutableArray *_menuTitles; NSMutableArray *_separatorIndexes; UIActionSheetStyle _actionSheetStyle; id _menu; struct { unsigned clickedButtonAtIndex : 1; unsigned willPresentActionSheet : 1; unsigned didPresentActionSheet : 1; unsigned willDismissWithButtonIndex : 1; unsigned didDismissWithButtonIndex : 1; unsigned actionSheetCancel : 1; } _delegateHas; } - (id)initWithTitle:(NSString *)title delegate:(id)delegate cancelButtonTitle:(NSString *)cancelButtonTitle destructiveButtonTitle:(NSString *)destructiveButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ...; - (NSInteger)addButtonWithTitle:(NSString *)title; - (void)showInView:(UIView *)view; // menu will appear wherever the mouse cursor is - (void)showFromRect:(CGRect)rect inView:(UIView *)view animated:(BOOL)animated; // if rect is CGRectNull, the menu will appear wherever the mouse cursor is - (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated; // these are not yet implemented: - (void)showFromToolbar:(UIToolbar *)view; - (void)showFromTabBar:(UITabBar *)view; - (void)showFromBarButtonItem:(UIBarButtonItem *)item animated:(BOOL)animated; @property (nonatomic, copy) NSString *title; @property (nonatomic, assign) id delegate; @property (nonatomic, assign) UIActionSheetStyle actionSheetStyle; @property (nonatomic, readonly, getter=isVisible) BOOL visible; @property (nonatomic) NSInteger destructiveButtonIndex; @property (nonatomic) NSInteger cancelButtonIndex; @property (nonatomic, readonly) NSInteger firstOtherButtonIndex; @property (nonatomic, readonly) NSInteger numberOfButtons; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIActionSheet.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIActionSheet.h" #import "UIWindow.h" #import "UIScreenAppKitIntegration.h" #import "UIKitView.h" #import "UIApplication+UIPrivate.h" #import "UIBarButtonItem.h" #import #import #import @implementation UIActionSheet @synthesize delegate=_delegate, destructiveButtonIndex=_destructiveButtonIndex, cancelButtonIndex=_cancelButtonIndex, title=_title; @synthesize firstOtherButtonIndex=_firstOtherButtonIndex, actionSheetStyle = _actionSheetStyle; - (id)initWithFrame:(CGRect)frame { if ((self=[super initWithFrame:frame])) { _menuTitles = [[NSMutableArray alloc] init]; _separatorIndexes = [[NSMutableArray alloc] init]; _destructiveButtonIndex = -1; _cancelButtonIndex = -1; _firstOtherButtonIndex = -1; } return self; } - (id)initWithTitle:(NSString *)title delegate:(id < UIActionSheetDelegate >)delegate cancelButtonTitle:(NSString *)cancelButtonTitle destructiveButtonTitle:(NSString *)destructiveButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ... { if ((self=[self initWithFrame:CGRectZero])) { self.delegate = delegate; _firstOtherButtonIndex = -1; // sort of a hack to reset this because the addButtonWithTitle's above can change it's value :) if (otherButtonTitles) { [self addButtonWithTitle:otherButtonTitles]; id buttonTitle = nil; va_list argumentList; va_start(argumentList, otherButtonTitles); while ((buttonTitle=(__bridge NSString *)va_arg(argumentList, void *))) { [self addButtonWithTitle:buttonTitle]; } va_end(argumentList); } if (destructiveButtonTitle) { self.destructiveButtonIndex = [self addButtonWithTitle:destructiveButtonTitle]; } if (cancelButtonTitle) { self.cancelButtonIndex = [self addButtonWithTitle:cancelButtonTitle]; } } return self; } - (void)dealloc { [_title release]; [_menu release]; [_menuTitles release]; [_separatorIndexes release]; [super dealloc]; } - (void)setDelegate:(id)newDelegate { _delegate = newDelegate; _delegateHas.clickedButtonAtIndex = [_delegate respondsToSelector:@selector(actionSheet:clickedButtonAtIndex:)]; _delegateHas.willPresentActionSheet = [_delegate respondsToSelector:@selector(willPresentActionSheet:)]; _delegateHas.didPresentActionSheet = [_delegate respondsToSelector:@selector(didPresentActionSheet:)]; _delegateHas.willDismissWithButtonIndex = [_delegate respondsToSelector:@selector(actionSheet:willDismissWithButtonIndex:)]; _delegateHas.didDismissWithButtonIndex = [_delegate respondsToSelector:@selector(actionSheet:didDismissWithButtonIndex:)]; _delegateHas.actionSheetCancel = [_delegate respondsToSelector:@selector(actionSheetCancel:)]; } - (NSInteger)addButtonWithTitle:(NSString *)title { [_menuTitles addObject:title ?: @""]; NSInteger index = [_menuTitles count]-1; if (_firstOtherButtonIndex == -1 ) { _firstOtherButtonIndex = index; } return index; } - (void)addSeparator { [_separatorIndexes addObject:[NSNumber numberWithInt:[_menuTitles count]]]; } - (void)setDestructiveButtonIndex:(NSInteger)index { if (index != _destructiveButtonIndex) { if (index >= 0) { assert(index<[_menuTitles count]); } else { index = -1; } _destructiveButtonIndex = index; } } - (void)setCancelButtonIndex:(NSInteger)index { if (index != _cancelButtonIndex) { if (index >= 0) { assert(index<[_menuTitles count]); } else { index = -1; } _cancelButtonIndex = index; } } - (BOOL)isVisible { return (_menu != nil); } - (NSInteger)numberOfButtons { return [_menuTitles count]; } - (void)_showFromPoint:(CGPoint)point rightAligned:(BOOL)rightAligned inView:(UIView *)view { [view addSubview:self]; if (!_menu && self.window) { _menu = [[NSMenu alloc] initWithTitle:_title ?: @""]; [_menu setAutoenablesItems:NO]; [_menu setAllowsContextMenuPlugIns:NO]; for (NSInteger index=0; index<[_menuTitles count]; index++) { if ([_separatorIndexes containsObject:[NSNumber numberWithInt:index]]) { [_menu addItem:[NSMenuItem separatorItem]]; } // don't even bother putting a cancel menu item on there. I think on OSX it's always going to be pointless // as clicking outside of the menu is always the same thing as tapping the cancel button and that's just // how it's got to work, I think. if (index != _cancelButtonIndex) { NSMenuItem *theItem = [[NSMenuItem alloc] initWithTitle:[_menuTitles objectAtIndex:index] action:@selector(_didSelectMenuItem:) keyEquivalent:@""]; [theItem setTag:index]; [theItem setTarget:self]; [_menu addItem:theItem]; [theItem release]; } } // convert the point from view's coordinate space to the underlying NSView's coordinate space CGPoint windowPoint = [self convertPoint:point toView:nil]; CGPoint screenPoint = [self.window convertPoint:windowPoint toWindow:nil]; // then offset it if desired if (rightAligned) { screenPoint.x -= [_menu size].width; } if (_delegateHas.willPresentActionSheet) { [_delegate willPresentActionSheet:self]; } // note that presenting an NSMenu is apparently modal. so, to pretend that it isn't, exactly, I'll delay the presentation // of the menu to the start of a new runloop. At least that way, code that may be expecting to run right after setting the // menu to visible would still run before the menu itself shows up on screen. Of course behavior is going to be pretty different // after that point since if the app is assuming it can keep on doing normal runloop stuff, it ain't gonna happen. // but since clicks outside of an NSMenu dismiss it, there's not a lot a user can do to an app to change state when a menu // is up in the first place. [self performSelector:@selector(_actuallyPresentTheMenuFromPoint:) withObject:[NSValue valueWithCGPoint:screenPoint] afterDelay:0]; } } - (void)_clickedButtonAtIndex:(NSInteger)index { if (_delegateHas.clickedButtonAtIndex){ [_delegate actionSheet:self clickedButtonAtIndex:index]; } if (index == _cancelButtonIndex && _delegateHas.actionSheetCancel) { [_delegate actionSheetCancel:self]; } if (_delegateHas.willDismissWithButtonIndex) { [_delegate actionSheet:self willDismissWithButtonIndex:index]; } [self dismissWithClickedButtonIndex:index animated:YES]; if (_delegateHas.didDismissWithButtonIndex) { [_delegate actionSheet:self didDismissWithButtonIndex:index]; } } - (void)_didSelectMenuItem:(NSMenuItem *)item { [self _clickedButtonAtIndex:[item tag]]; } - (void)_actuallyPresentTheMenuFromPoint:(NSValue *)aPoint { // hard to say where best to put this, but I guess this makes some sense? I can't call it after it's actually // on screen because of the modal-ness of NSMenu if (_delegateHas.didPresentActionSheet) { [_delegate didPresentActionSheet:self]; } // this goes modal... meh. BOOL itemSelected = [_menu popUpMenuPositioningItem:nil atLocation:NSPointFromCGPoint([aPoint CGPointValue]) inView:[self.window.screen UIKitView]]; // because of the modal nature of NSMenu, if there's a touch active (like, being held down) when a menu is triggered, the modal NSMenu // takes over the event stream and so a mouseUp is never delivered to the UIKitView. This means it never gets to the app and it leaves // the "touch" tracking system in an inconsistent state. This triggers the touchesCancelled UIResponder stuff to allow UIKit code to clean // itself up after the menu is done. [[UIApplication sharedApplication] _cancelTouches]; if (!itemSelected) { [self _clickedButtonAtIndex:_cancelButtonIndex]; } } - (void)showInView:(UIView *)view { // Since we're using an NSMenu to represent UIActionSheet on OSX, I'm going to make the assumption that a showInView: is triggered from // a click somewhere. If it's triggered on a delay, that might be a problem. However for a typical app, I suspect that is generally // not the case. I can't think of a better behavior right now, so I'm going to fetch the current mouse position and translate coords // so that the menu presents from there. [self showFromRect:CGRectNull inView:view animated:YES]; } - (void)showFromRect:(CGRect)rect inView:(UIView *)view animated:(BOOL)animated { // If the rect is NULL, use that as a flag to indicate that the menu should be presented from wherever the mouse cursor is // instead of a specific place on screen. This is not really normal UIKit behavior, of course, but I think it makes sense // here on the Mac. if (CGRectIsNull(rect)) { // translate them thar points! NSPoint mouseLocation = [NSEvent mouseLocation]; CGPoint screenPoint = [view.window.screen convertPoint:NSPointToCGPoint(mouseLocation) fromScreen:nil]; CGPoint windowPoint = [view.window convertPoint:screenPoint fromWindow:nil]; CGPoint viewPoint = [view convertPoint:windowPoint fromView:nil]; [self _showFromPoint:viewPoint rightAligned:NO inView:view]; } else { [self _showFromPoint:CGPointMake(rect.origin.x+rect.size.width, rect.origin.y+rect.size.height) rightAligned:YES inView:view]; } } - (void)showFromToolbar:(UIToolbar *)view { } - (void)showFromTabBar:(UITabBar *)view { } - (void)showFromBarButtonItem:(UIBarButtonItem *)item animated:(BOOL)animated { } - (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated { if (animated) { [_menu cancelTracking]; } else { [_menu cancelTrackingWithoutAnimation]; } // kill off the menu [_menu release]; _menu = nil; // remove ourself from the superview that we piggy-backed on [self removeFromSuperview]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIActionSheetAppKitIntegration.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIActionSheet.h" @interface UIActionSheet (AppKitIntegration) - (void)addSeparator; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIActivityIndicatorView.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIView.h" typedef enum { UIActivityIndicatorViewStyleWhiteLarge, UIActivityIndicatorViewStyleWhite, UIActivityIndicatorViewStyleGray, } UIActivityIndicatorViewStyle; @interface UIActivityIndicatorView : UIView { @private UIActivityIndicatorViewStyle _activityIndicatorViewStyle; BOOL _hidesWhenStopped; BOOL _animating; } - (id)initWithActivityIndicatorStyle:(UIActivityIndicatorViewStyle)style; - (void)startAnimating; - (void)stopAnimating; - (BOOL)isAnimating; @property BOOL hidesWhenStopped; @property UIActivityIndicatorViewStyle activityIndicatorViewStyle; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIActivityIndicatorView.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIActivityIndicatorView.h" #import "UIImage.h" #import "UIGraphics.h" #import "UIColor.h" #import "UIFont.h" #import "UIStringDrawing.h" #import "UIBezierPath.h" #import static CGSize UIActivityIndicatorViewStyleSize(UIActivityIndicatorViewStyle style) { if (style == UIActivityIndicatorViewStyleWhiteLarge) { return CGSizeMake(37,37); } else { return CGSizeMake(20,20); } } static UIImage *UIActivityIndicatorViewFrameImage(UIActivityIndicatorViewStyle style, NSInteger frame, NSInteger numberOfFrames, CGFloat scale) { const CGSize frameSize = UIActivityIndicatorViewStyleSize(style); const CGFloat radius = frameSize.width / 2.f; const CGFloat TWOPI = M_PI * 2.f; const CGFloat numberOfTeeth = 12; const CGFloat toothWidth = (style == UIActivityIndicatorViewStyleWhiteLarge)? 3.5 : 2; UIColor *toothColor = (style == UIActivityIndicatorViewStyleGray)? [UIColor grayColor] : [UIColor whiteColor]; UIGraphicsBeginImageContextWithOptions(frameSize, NO, scale); CGContextRef c = UIGraphicsGetCurrentContext(); // first put the origin in the center of the frame. this makes things easier later CGContextTranslateCTM(c, radius, radius); // now rotate the entire thing depending which frame we're trying to generate CGContextRotateCTM(c, frame / (CGFloat)numberOfFrames * TWOPI); // draw all the teeth for (NSInteger toothNumber=0; toothNumber _delegate; NSInteger _cancelButtonIndex; NSMutableArray *_buttonTitles; struct { unsigned clickedButtonAtIndex : 1; unsigned alertViewCancel : 1; unsigned willPresentAlertView : 1; unsigned didPresentAlertView : 1; unsigned willDismissWithButtonIndex : 1; unsigned didDismissWithButtonIndex : 1; } _delegateHas; } - (id)initWithTitle:(NSString *)title message:(NSString *)message delegate:(id)delegate cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ...; - (NSInteger)addButtonWithTitle:(NSString *)title; - (NSString *)buttonTitleAtIndex:(NSInteger)buttonIndex; - (void)show; - (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated; // not implemented at the moment since I use NSAlert and runModal and this would present problems. :/ @property (nonatomic, copy) NSString *title; @property (nonatomic, copy) NSString *message; @property (nonatomic, assign) id delegate; @property (nonatomic) NSInteger cancelButtonIndex; @property (nonatomic,readonly) NSInteger numberOfButtons; @end @protocol UIAlertViewDelegate @optional - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex; - (void)alertViewCancel:(UIAlertView *)alertView; // never called - (void)willPresentAlertView:(UIAlertView *)alertView; // before animation and showing view - (void)didPresentAlertView:(UIAlertView *)alertView; // after animation - (void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex; // before animation and hiding view - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex; // after animation @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIAlertView.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIAlertView.h" #import "UIApplication.h" #import #import #import @interface UIAlertView () @property (nonatomic, strong) NSMutableArray *buttonTitles; @end @implementation UIAlertView @synthesize title=_title, message=_message, delegate=_delegate, cancelButtonIndex=_cancelButtonIndex, buttonTitles=_buttonTitles; - (id)initWithTitle:(NSString *)title message:(NSString *)message delegate:(id)delegate cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ... { if ((self=[super initWithFrame:CGRectZero])) { self.title = title; self.message = message; self.delegate = delegate; self.buttonTitles = [NSMutableArray arrayWithCapacity:1]; if (cancelButtonTitle) { self.cancelButtonIndex = [self addButtonWithTitle:cancelButtonTitle]; } if (otherButtonTitles) { [self addButtonWithTitle:otherButtonTitles]; id buttonTitle = nil; va_list argumentList; va_start(argumentList, otherButtonTitles); while ((buttonTitle=(__bridge NSString *)va_arg(argumentList, void *))) { [self addButtonWithTitle:buttonTitle]; } va_end(argumentList); } } return self; } - (void)dealloc { [_title release]; [_message release]; [_buttonTitles release]; [super dealloc]; } - (void)setDelegate:(id)newDelegate { _delegate = newDelegate; _delegateHas.clickedButtonAtIndex = [_delegate respondsToSelector:@selector(alertView:clickedButtonAtIndex:)]; _delegateHas.alertViewCancel = [_delegate respondsToSelector:@selector(alertViewCancel:)]; _delegateHas.willPresentAlertView = [_delegate respondsToSelector:@selector(willPresentAlertView:)]; _delegateHas.didPresentAlertView = [_delegate respondsToSelector:@selector(didPresentAlertView:)]; _delegateHas.willDismissWithButtonIndex = [_delegate respondsToSelector:@selector(alertView:willDismissWithButtonIndex:)]; _delegateHas.didDismissWithButtonIndex = [_delegate respondsToSelector:@selector(alertView:didDismissWithButtonIndex:)]; } - (NSInteger)addButtonWithTitle:(NSString *)title { [self.buttonTitles addObject:title]; return ([self.buttonTitles count] - 1); } - (NSString *)buttonTitleAtIndex:(NSInteger)buttonIndex { return [self.buttonTitles objectAtIndex:buttonIndex]; } - (NSInteger)numberOfButtons { return [self.buttonTitles count]; } - (void)show { // capture the current button configuration and build an NSAlert // we show it after letting the runloop finish because UIKit stuff is often written with the assumption // that showing an alert doesn't block the runloop. Kinda icky, but the same pattern is used for UIActionSheet // and the UIMenuController and I don't know there's a lot that I can do about it. // NSAlert does have a mode that doesn't block the runloop, but it has other drawbacks that I didn't like // so opting to do it this way here. :/ NSAlert *alert = [[[NSAlert alloc] init] autorelease]; NSMutableArray *buttonOrder = [[[NSMutableArray alloc] initWithCapacity:self.numberOfButtons] autorelease]; if (self.title) { [alert setMessageText:self.title]; } if (self.message) { [alert setInformativeText:self.message]; } for (NSInteger buttonIndex=0; buttonIndex= 0) { NSButton *btn = [alert addButtonWithTitle:[self.buttonTitles objectAtIndex:self.cancelButtonIndex]]; // only change the key equivelent if there's more than one button, otherwise we lose the "Return" key for triggering the default action if (self.numberOfButtons > 1) { [btn setKeyEquivalent:@"\033"]; // this should make the escape key trigger the cancel option } [buttonOrder addObject:[NSNumber numberWithInt:self.cancelButtonIndex]]; } if (_delegateHas.willPresentAlertView) { [_delegate willPresentAlertView:self]; } [self performSelector:@selector(_showAlertWithOptions:) withObject:[NSDictionary dictionaryWithObjectsAndKeys: alert, @"alert", buttonOrder, @"buttonOrder", nil] afterDelay:0]; } - (void)_showAlertWithOptions:(NSDictionary *)options { NSAlert *alert = [options objectForKey:@"alert"]; NSMutableArray *buttonOrder = [options objectForKey:@"buttonOrder"]; if (_delegateHas.didPresentAlertView) { [_delegate didPresentAlertView:self]; } NSInteger result = [alert runModal]; NSInteger buttonIndex = -1; switch (result) { case NSAlertFirstButtonReturn: buttonIndex = [[buttonOrder objectAtIndex:0] intValue]; break; case NSAlertSecondButtonReturn: buttonIndex = [[buttonOrder objectAtIndex:1] intValue]; break; case NSAlertThirdButtonReturn: buttonIndex = [[buttonOrder objectAtIndex:2] intValue]; break; default: buttonIndex = [[buttonOrder objectAtIndex:2+(result-NSAlertThirdButtonReturn)] intValue]; break; } if (_delegateHas.clickedButtonAtIndex) { [_delegate alertView:self clickedButtonAtIndex:buttonIndex]; } if (_delegateHas.willDismissWithButtonIndex) { [_delegate alertView:self willDismissWithButtonIndex:buttonIndex]; } if (_delegateHas.didDismissWithButtonIndex) { [_delegate alertView:self didDismissWithButtonIndex:buttonIndex]; } } - (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated { } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIAppearance.h ================================================ /* * Copyright (c) 2012, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import #define UI_APPEARANCE_SELECTOR @protocol UIAppearanceContainer @end @protocol UIAppearance + (id)appearance; + (id)appearanceWhenContainedIn:(Class )ContainerClass, ... NS_REQUIRES_NIL_TERMINATION; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIAppearanceInstance.h ================================================ /* * Copyright (c) 2012, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIAppearance.h" @class UIAppearanceProperty; @interface NSObject (UIAppearanceInstance) + (id)appearance; + (id)appearanceWhenContainedIn:(Class )containerClass, ...; - (void)_appearancePropertyDidChange:(UIAppearanceProperty *)property; - (id)_appearanceContainer; - (void)_updateAppearanceIfNeeded; - (void)_setAppearanceNeedsUpdate; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIAppearanceInstance.m ================================================ /* * Copyright (c) 2012, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIAppearanceInstance.h" #import "UIAppearanceProperty.h" #import "UIAppearanceProxy.h" #import static const char *UIAppearanceClassAssociatedObjectKey = "UIAppearanceClassAssociatedObjectKey"; static const char *UIAppearanceInstanceAssociatedObjectKey = "UIAppearanceInstanceAssociatedObjectKey"; static NSString * const UIAppearanceInstancePropertiesKey = @"UIAppearanceInstancePropertiesKey"; static NSString * const UIAppearanceInstanceNeedsUpdateKey = @"UIAppearanceInstanceNeedsUpdateKey"; static NSMutableDictionary *UIAppearanceInstanceDictionary(id object) { return objc_getAssociatedObject(object, UIAppearanceInstanceAssociatedObjectKey); } static NSMutableDictionary *UIAppearanceInstanceDictionaryCreateIfNeeded(id object) { NSMutableDictionary *info = UIAppearanceInstanceDictionary(object); if (!info) { info = [NSMutableDictionary dictionaryWithCapacity:1]; objc_setAssociatedObject(object, UIAppearanceInstanceAssociatedObjectKey, info, OBJC_ASSOCIATION_RETAIN); } return info; } static void UIAppearanceInstanceSetProperties(id object, NSSet *properties) { if ([properties count] > 0) { [UIAppearanceInstanceDictionaryCreateIfNeeded(object) setObject:properties forKey:UIAppearanceInstancePropertiesKey]; } else { [UIAppearanceInstanceDictionary(object) removeObjectForKey:UIAppearanceInstancePropertiesKey]; } } static NSSet *UIAppearanceInstanceProperties(id object) { return [UIAppearanceInstanceDictionary(object) objectForKey:UIAppearanceInstancePropertiesKey]; } static void UIAppearanceInstancePropertyDidChange(id object, UIAppearanceProperty *property) { UIAppearanceInstanceSetProperties(object, [[NSSet setWithObject:property] setByAddingObjectsFromSet:UIAppearanceInstanceProperties(object)]); } static BOOL UIAppearanceInstanceNeedsUpdate(id object) { return [[UIAppearanceInstanceDictionary(object) objectForKey:UIAppearanceInstanceNeedsUpdateKey] boolValue]; } static void UIAppearanceInstanceSetNeedsUpdate(id object, BOOL needsUpdate) { [UIAppearanceInstanceDictionaryCreateIfNeeded(object) setObject:[NSNumber numberWithBool:needsUpdate] forKey:UIAppearanceInstanceNeedsUpdateKey]; } static NSArray *UIAppearanceHierarchyForClass(Class klass) { NSMutableArray *classes = [[NSMutableArray alloc] initWithCapacity:0]; while ([(id)klass conformsToProtocol:@protocol(UIAppearance)]) { [classes insertObject:klass atIndex:0]; klass = [klass superclass]; } return [classes autorelease]; } @implementation NSObject (UIAppearanceInstance) + (id)appearance { return [self appearanceWhenContainedIn:nil]; } + (id)appearanceWhenContainedIn:(Class )containerClass, ... { NSMutableDictionary *appearanceRules = objc_getAssociatedObject(self, UIAppearanceClassAssociatedObjectKey); if (!appearanceRules) { appearanceRules = [NSMutableDictionary dictionaryWithCapacity:1]; objc_setAssociatedObject(self, UIAppearanceClassAssociatedObjectKey, appearanceRules, OBJC_ASSOCIATION_RETAIN); } NSMutableArray *containmentPath = [NSMutableArray arrayWithCapacity:1]; va_list args; va_start(args, containerClass); for (; containerClass != nil; containerClass = va_arg(args, Class )) { [containmentPath addObject:containerClass]; } va_end(args); UIAppearanceProxy *record = [appearanceRules objectForKey:containmentPath]; if (!record) { record = [[[UIAppearanceProxy alloc] initWithClass:self] autorelease]; [appearanceRules setObject:record forKey:containmentPath]; } return record; } - (void)_appearancePropertyDidChange:(UIAppearanceProperty *)property { UIAppearanceInstancePropertyDidChange(self, property); } - (id)_appearanceContainer { return nil; } - (void)_updateAppearanceIfNeeded { if (UIAppearanceInstanceNeedsUpdate(self)) { // first go down our own class heirarchy until we find the root of the UIAppearance protocol // then we'll start at the bottom and work up while checking each class for all relevant rules // that apply to this instance at this time. NSArray *classes = UIAppearanceHierarchyForClass([self class]); NSMutableDictionary *propertiesToSet = [NSMutableDictionary dictionaryWithCapacity:0]; for (Class klass in classes) { NSMutableDictionary *rules = objc_getAssociatedObject(klass, UIAppearanceClassAssociatedObjectKey); // sorts the rule keys (which are arrays of classes) by length // if the lengths match, it sorts based on the last class being a superclass of the other or vice-versa // if the last classes aren't related at all, it marks them equal (I suspect these cases will always be filtered out in the next step) NSArray *sortedRulePaths = [[rules allKeys] sortedArrayUsingComparator:^NSComparisonResult(NSArray *path1, NSArray *path2) { if ([path1 count] == [path2 count]) { if ([[path2 lastObject] isKindOfClass:[path1 lastObject]]) { return (NSComparisonResult)NSOrderedAscending; } else if ([[path1 lastObject] isKindOfClass:[path2 lastObject]]) { return (NSComparisonResult)NSOrderedDescending; } else { return (NSComparisonResult)NSOrderedSame; } } else if ([path1 count] < [path2 count]) { return (NSComparisonResult)NSOrderedAscending; } else { return (NSComparisonResult)NSOrderedDescending; } }]; // we should now have a list of classes to check for rule settings for this instance, so now we spin // through those and fetch the properties and values and add them to the dictionary of things to do. // before applying a rule's properties, we must make sure this instance is qualified, so we must check // this instance's container hierarchy against ever class that makes up the rule. for (NSArray *rule in sortedRulePaths) { BOOL shouldApplyRule = YES; for (Class klass in [rule reverseObjectEnumerator]) { id container = [self _appearanceContainer]; while (container && ![container isKindOfClass:klass]) { container = [container _appearanceContainer]; } if (!container) { shouldApplyRule = NO; break; } } if (shouldApplyRule) { UIAppearanceProxy *proxy = [rules objectForKey:rule]; [propertiesToSet addEntriesFromDictionary:[proxy _appearancePropertiesAndValues]]; } } } // before setting the actual properties on the instance, save off a copy of the existing modified properties // because the act of setting the UIAppearance properties will end up messing with that set. // after we're done actually applying everything, reset the modified properties set to what it was before. NSSet *originalProperties = [UIAppearanceInstanceProperties(self) copy]; // subtract any properties that have been overriden from the list to apply [propertiesToSet removeObjectsForKeys:[originalProperties allObjects]]; // now apply everything that's left [propertiesToSet enumerateKeysAndObjectsUsingBlock:^(UIAppearanceProperty *property, NSValue *value, BOOL *stop) { [property invokeSetterUsingTarget:self withValue:value]; }]; // now reset our set of changes properties to the original set so we don't count the UIAppearance defaults UIAppearanceInstanceSetProperties(self, originalProperties); [originalProperties release]; // done! UIAppearanceInstanceSetNeedsUpdate(self, NO); } } - (void)_setAppearanceNeedsUpdate { UIAppearanceInstanceSetNeedsUpdate(self, YES); } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIAppearanceProperty.h ================================================ /* * Copyright (c) 2012, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @interface UIAppearanceProperty : NSObject { SEL cmd; NSArray *axisValues; } - (id)initWithSelector:(SEL)sel axisValues:(NSArray *)values; - (void)invokeSetterUsingTarget:(id)target withValue:(NSValue *)value; @property (nonatomic, readonly) NSArray *axisValues; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIAppearanceProperty.m ================================================ /* * Copyright (c) 2012, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIAppearanceProperty.h" @implementation UIAppearanceProperty @synthesize axisValues; - (id)initWithSelector:(SEL)sel axisValues:(NSArray *)values { if ((self=[super init])) { cmd = sel; axisValues = [values copy]; } return self; } - (void)dealloc { [axisValues release]; [super dealloc]; } - (BOOL)isEqual:(id)object { if (object == self) { return YES; } else if ([object isKindOfClass:[UIAppearanceProperty class]]) { UIAppearanceProperty *entry = (UIAppearanceProperty *)object; return cmd == entry->cmd && [axisValues isEqual:entry->axisValues]; } else { return NO; } } - (NSUInteger)hash { return [NSStringFromSelector(cmd) hash] ^ [axisValues hash]; } - (id)copyWithZone:(NSZone *)zone { return [[UIAppearanceProperty alloc] initWithSelector:cmd axisValues:axisValues]; } - (void)invokeSetterUsingTarget:(id)target withValue:(NSValue *)value { NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[target methodSignatureForSelector:cmd]]; for (int i=0; i<[[invocation methodSignature] numberOfArguments]; i++) { if (i == 0) { [invocation setTarget:target]; } else if (i == 1) { [invocation setSelector:cmd]; } else { NSValue *v = (i == 2)? value : [axisValues objectAtIndex:i-3]; NSUInteger bufferSize = 0; NSGetSizeAndAlignment([v objCType], &bufferSize, NULL); UInt8 argumentBuffer[bufferSize]; memset(argumentBuffer, 0, bufferSize); [v getValue:argumentBuffer]; [invocation setArgument:argumentBuffer atIndex:i]; } } [invocation invoke]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIAppearanceProxy.h ================================================ /* * Copyright (c) 2012, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIAppearance.h" #import @interface UIAppearanceProxy : NSObject { Class _targetClass; NSMutableDictionary *_settings; } - (id)initWithClass:(Class)k; - (NSDictionary *)_appearancePropertiesAndValues; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIAppearanceProxy.m ================================================ /* * Copyright (c) 2012, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIAppearanceProxy.h" #import "UIAppearanceProperty.h" #import #import #import "UIAppearanceInstance.h" static const char *UIAppearanceSetterOverridesAssociatedObjectKey = "UIAppearanceSetterOverridesAssociatedObjectKey"; static BOOL TypeIsSignedInteger(const char *t) { return (t != NULL) && (strcmp(t,@encode(char)) == 0 || strcmp(t,@encode(int)) == 0 || strcmp(t,@encode(short)) == 0 || strcmp(t,@encode(long)) == 0 || strcmp(t,@encode(long long)) == 0); } static BOOL TypeIsUnsignedInteger(const char *t) { return (t != NULL) && (strcmp(t,@encode(unsigned char)) == 0 || strcmp(t,@encode(unsigned int)) == 0 || strcmp(t,@encode(unsigned short)) == 0 || strcmp(t,@encode(unsigned long)) == 0 || strcmp(t,@encode(unsigned long long)) == 0); } static BOOL TypeIsObject(const char *t) { return (t != NULL) && strcmp(t,@encode(id)) == 0; } static BOOL TypeIsCGFloat(const char *t) { return (t != NULL) && strcmp(t,@encode(CGFloat)) == 0; } static BOOL TypeIsCGPoint(const char *t) { return (t != NULL) && strcmp(t,@encode(CGPoint)) == 0; } static BOOL TypeIsCGSize(const char *t) { return (t != NULL) && strcmp(t,@encode(CGSize)) == 0; } static BOOL TypeIsCGRect(const char *t) { return (t != NULL) && strcmp(t,@encode(CGRect)) == 0; } static BOOL TypeIsUIEdgeInsets(const char *t) { return (t != NULL) && strcmp(t,@encode(UIEdgeInsets)) == 0; } static BOOL TypeIsUIOffset(const char *t) { return (t != NULL) && strcmp(t,@encode(UIOffset)) == 0; } static BOOL TypeIsIntegerType(const char *t) { return TypeIsSignedInteger(t) || TypeIsUnsignedInteger(t); } static BOOL TypeIsPropertyType(const char *t) { return TypeIsIntegerType(t) || TypeIsObject(t) || TypeIsCGFloat(t) || TypeIsCGPoint(t) || TypeIsCGSize(t) || TypeIsCGRect(t) || TypeIsUIEdgeInsets(t) || TypeIsUIOffset(t); } // fetches the original IMP for the method that we tucked away earlier (see down below) when we first registered // an appearance setting for this class/property combo. static IMP GetOriginalMethodIMP(id self, SEL cmd) { NSValue *boxedMethodImp = nil; Class klass = [self class]; while (klass && !boxedMethodImp) { NSDictionary *overrides = objc_getAssociatedObject(klass, UIAppearanceSetterOverridesAssociatedObjectKey); boxedMethodImp = [overrides objectForKey:NSStringFromSelector(cmd)]; klass = [klass superclass]; } if (boxedMethodImp && strcmp(@encode(IMP), [boxedMethodImp objCType]) == 0) { IMP imp; [boxedMethodImp getValue:&imp]; return imp; } else { return NULL; } } // this function is used by the setter override to record which property with which axis values was set // it then attaches that record to the *instance* (not the class!) so this information can be used later // (currently in UIView) to intelligently apply the default UIAppearance rules without having them override // settings that were set on the instance directly somewhere. this is how Apple's stuff works and that feature // is the reason we have to go through all this trouble overriding stuff in the first place! static void DidSetPropertyWithAxisValues(id self, SEL cmd, NSInteger numberOfAxisValues, NSInteger *axisValues) { NSMutableArray *values = [NSMutableArray arrayWithCapacity:numberOfAxisValues]; for (NSInteger i=0; i)k { if ((self=[super init])) { _targetClass = k; _settings = [[NSMutableDictionary alloc] initWithCapacity:0]; } return self; } - (void)dealloc { [_settings release]; [super dealloc]; } - (void)forwardInvocation:(NSInvocation *)anInvocation { // allowed selector formats: // -set:forAxis:axis:axis:... // -ForAxis:axis:axis... // // the axis parts are optional. // property values must be one of these types: id, NSInteger, NSUInteger, CGFloat, CGPoint, CGSize, CGRect, UIEdgeInsets or UIOffset. // each axis must be either NSInteger or NSUInteger. // throw an exception if other types are used in an axis. // see if this selector is a setter or a getter const BOOL isSetter = [NSStringFromSelector([anInvocation selector]) hasPrefix:@"set"] && [[anInvocation methodSignature] numberOfArguments] > 2 && strcmp([[anInvocation methodSignature] methodReturnType], @encode(void)) == 0; const BOOL isGetter = !isSetter && strcmp([[anInvocation methodSignature] methodReturnType], @encode(void)) != 0; // ensure that the property type is legit const char *propertyType = isSetter? [[anInvocation methodSignature] getArgumentTypeAtIndex:2] : (isGetter? [[anInvocation methodSignature] methodReturnType] : NULL); if (!TypeIsPropertyType(propertyType)) { @throw [NSException exceptionWithName:NSInvalidArgumentException reason:@"property type must be id, NSInteger, NSUInteger, CGFloat, CGPoint, CGSize, CGRect, UIEdgeInsets or UIOffset" userInfo:nil]; } // this will hold the NSValue objects made out of the arguments NSMutableArray *argumentValues = [NSMutableArray arrayWithCapacity:[[anInvocation methodSignature] numberOfArguments]-2]; // box the arguments for (int i=2; i<[[anInvocation methodSignature] numberOfArguments]; i++) { const char *type = [[anInvocation methodSignature] getArgumentTypeAtIndex:i]; if ((isSetter && i > 2) || isGetter) { // ensure that the axis arguments are integers if (!TypeIsIntegerType(type)) { @throw [NSException exceptionWithName:NSInvalidArgumentException reason:@"axis type must be NSInteger or NSUInteger" userInfo:nil]; } } // we need a buffer to pull out the argument data, so we'll figure out the size of the data first and then make the buffer NSUInteger bufferSize = 0; NSGetSizeAndAlignment(type, &bufferSize, NULL); UInt8 argumentBuffer[bufferSize]; memset(argumentBuffer, 0, bufferSize); // fetch the actual value data into our fancy buffer [anInvocation getArgument:argumentBuffer atIndex:i]; // now box it up and tie it with a bow NSValue *value = [NSValue value:argumentBuffer withObjCType:type]; if (value) { [argumentValues addObject:value]; } else { @throw [NSException exceptionWithName:NSInternalInconsistencyException reason:@"something terrible has happened" userInfo:nil]; } } if (isSetter) { // make a key so we can store this particular property value given the axis values UIAppearanceProperty *key = [[UIAppearanceProperty alloc] initWithSelector:[anInvocation selector] axisValues:[argumentValues subarrayWithRange:NSMakeRange(1, [argumentValues count]-1)]]; [_settings setObject:[argumentValues objectAtIndex:0] forKey:key]; // what we're doing here is sneakily overriding the existing implemention with our own so we can track when the setter is called // and not have the appearance defaults override if a more local setting has been made. // the plan is to replace the class's original implementation of the setter with a custom one and save off the original IMP // so that we can call it later after doing what we need to do in the custom setter. // this checks to see if we've overriden the current setter for this class or not, and if not, we do so and store it off // in an associated dictionary that's attached to the class itself so we can get at it later from our setter. // I could not come up with a better way to do this and I have no idea how safe this really is at this point. // I wanted to insert a custom class a bit like how KVO apparently works, but it turns out most of the functions I need // for that are either deprecated or marked as "don't use" in the docs. :/ this is the best I could come up with given my // current knowledge of how everything works at this abstraction level. abandon all hope, ye who enter here... NSString *selectorString = NSStringFromSelector([anInvocation selector]); NSMutableDictionary *methodOverrides = objc_getAssociatedObject(_targetClass, UIAppearanceSetterOverridesAssociatedObjectKey); if (!methodOverrides) { methodOverrides = [NSMutableDictionary dictionaryWithCapacity:1]; objc_setAssociatedObject(_targetClass, UIAppearanceSetterOverridesAssociatedObjectKey, methodOverrides, OBJC_ASSOCIATION_RETAIN); } if (![methodOverrides objectForKey:selectorString]) { Method method = class_getInstanceMethod(_targetClass, [anInvocation selector]); if (method) { IMP implementation = method_getImplementation(method); IMP overrideImplementation = ImplementationForPropertyType([[anInvocation methodSignature] getArgumentTypeAtIndex:2]); if (implementation != overrideImplementation) { [methodOverrides setObject:[NSValue valueWithBytes:&implementation objCType:@encode(IMP)] forKey:selectorString]; class_replaceMethod(_targetClass, [anInvocation selector], overrideImplementation, method_getTypeEncoding(method)); } } } [key release]; } else if (isGetter) { // convert the getter's selector into a setter's selector since that's what we keyed on above NSMutableString *selectorString = [NSStringFromSelector([anInvocation selector]) mutableCopy]; [selectorString replaceCharactersInRange:NSMakeRange(0, 1) withString:[[selectorString substringToIndex:1] uppercaseString]]; [selectorString insertString:@"set" atIndex:0]; // if the property has 1 or more axis parts, we need to take those into account, too if ([[anInvocation methodSignature] numberOfArguments] > 2) { const NSRange colonRange = [selectorString rangeOfString:@":"]; const NSRange forRange = [selectorString rangeOfString:@"For"]; if (colonRange.location != NSNotFound && forRange.location != NSNotFound && colonRange.location > NSMaxRange(forRange)) { const NSRange axisNameRange = NSMakeRange(forRange.location+3, colonRange.location-forRange.location-3); NSString *axisName = [selectorString substringWithRange:axisNameRange]; axisName = [axisName stringByReplacingCharactersInRange:NSMakeRange(0, 1) withString:[[axisName substringToIndex:1] uppercaseString]]; NSString *axisSelectorPartName = [NSString stringWithFormat:@"for%@:", axisName]; [selectorString insertString:axisSelectorPartName atIndex:NSMaxRange(colonRange)]; [selectorString replaceCharactersInRange:NSMakeRange(forRange.location, colonRange.location-forRange.location) withString:@""]; } } else { [selectorString appendString:@":"]; } // now build a key based on the generated setter selector and the given axis arguments and fetch the matching stored property value UIAppearanceProperty *key = [[UIAppearanceProperty alloc] initWithSelector:NSSelectorFromString(selectorString) axisValues:argumentValues]; NSValue *propertyValue = [_settings objectForKey:key]; // setup a return data buffer and zero it const NSUInteger returnLength = [[anInvocation methodSignature] methodReturnLength]; UInt8 returnData[returnLength]; memset(returnData, 0, returnLength); // fetch the value and return it - if there is none, this ends up returning a zeroed data structure [propertyValue getValue:returnData]; [anInvocation setReturnValue:returnData]; [key release]; [selectorString release]; } else { // derp [self doesNotRecognizeSelector:[anInvocation selector]]; } } - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector { return [super methodSignatureForSelector:aSelector] ?: [(id)_targetClass instanceMethodSignatureForSelector:aSelector]; } - (NSDictionary *)_appearancePropertiesAndValues { return [[_settings copy] autorelease]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIApplication+UIPrivate.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIApplication.h" @class UIWindow, UIScreen, NSEvent, UIPopoverController; @interface UIApplication (UIPrivate) - (void)_setKeyWindow:(UIWindow *)newKeyWindow; - (void)_windowDidBecomeVisible:(UIWindow *)theWindow; - (void)_windowDidBecomeHidden:(UIWindow *)theWindow; - (BOOL)_sendGlobalKeyboardNSEvent:(NSEvent *)theNSEvent fromScreen:(UIScreen *)theScreen; // checks for CMD-Return/Enter and returns YES if it was handled, NO if not - (BOOL)_sendKeyboardNSEvent:(NSEvent *)theNSEvent fromScreen:(UIScreen *)theScreen; // returns YES if it was handled within UIKit (first calls _sendGlobalKeyboardNSEvent:fromScreen:) - (void)_sendMouseNSEvent:(NSEvent *)theNSEvent fromScreen:(UIScreen *)theScreen; - (void)_cancelTouches; - (void)_removeViewFromTouches:(UIView *)aView; - (UIResponder *)_firstResponderForScreen:(UIScreen *)screen; - (BOOL)_firstResponderCanPerformAction:(SEL)action withSender:(id)sender fromScreen:(UIScreen *)theScreen; - (BOOL)_sendActionToFirstResponder:(SEL)action withSender:(id)sender fromScreen:(UIScreen *)theScreen; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIApplication.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIResponder.h" #import "UIDevice.h" #import "UIApplicationDelegate.h" extern NSString *const UIApplicationWillChangeStatusBarOrientationNotification; extern NSString *const UIApplicationDidChangeStatusBarOrientationNotification; extern NSString *const UIApplicationWillEnterForegroundNotification; extern NSString *const UIApplicationWillTerminateNotification; extern NSString *const UIApplicationWillResignActiveNotification; extern NSString *const UIApplicationDidEnterBackgroundNotification; extern NSString *const UIApplicationDidBecomeActiveNotification; extern NSString *const UIApplicationDidFinishLaunchingNotification; extern NSString *const UIApplicationLaunchOptionsURLKey; extern NSString *const UIApplicationLaunchOptionsSourceApplicationKey; extern NSString *const UIApplicationLaunchOptionsRemoteNotificationKey; extern NSString *const UIApplicationLaunchOptionsAnnotationKey; extern NSString *const UIApplicationLaunchOptionsLocalNotificationKey; extern NSString *const UIApplicationLaunchOptionsLocationKey; extern NSString *const UIApplicationDidReceiveMemoryWarningNotification; extern NSString *const UITrackingRunLoopMode; typedef enum { UIStatusBarStyleDefault, UIStatusBarStyleBlackTranslucent, UIStatusBarStyleBlackOpaque } UIStatusBarStyle; typedef enum { UIInterfaceOrientationPortrait = UIDeviceOrientationPortrait, UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown, UIInterfaceOrientationLandscapeLeft = UIDeviceOrientationLandscapeRight, UIInterfaceOrientationLandscapeRight = UIDeviceOrientationLandscapeLeft } UIInterfaceOrientation; #define UIInterfaceOrientationIsPortrait(orientation) \ ((orientation) == UIInterfaceOrientationPortrait || \ (orientation) == UIInterfaceOrientationPortraitUpsideDown) #define UIInterfaceOrientationIsLandscape(orientation) \ ((orientation) == UIInterfaceOrientationLandscapeLeft || \ (orientation) == UIInterfaceOrientationLandscapeRight) // push is not gonna work in mac os, unless you are apple (facetime) typedef enum { UIRemoteNotificationTypeNone = 0, UIRemoteNotificationTypeBadge = 1 << 0, UIRemoteNotificationTypeSound = 1 << 1, UIRemoteNotificationTypeAlert = 1 << 2 } UIRemoteNotificationType; // whenever the NSApplication is no longer "active" from OSX's point of view, your UIApplication instance // will switch to UIApplicationStateInactive. This happens when the app is no longer in the foreground, for instance. // chameleon will also switch to the inactive state when the screen is put to sleep due to power saving mode. // when the screen wakes up or the app is brought to the foreground, it is switched back to UIApplicationStateActive. // // UIApplicationStateBackground is now supported and your app will transition to this state in two possible ways. // one is when the AppKitIntegration method -terminateApplicationBeforeDate: is called. that method is intended to be // used when your NSApplicationDelegate is being asked to terminate. the application is also switched to // UIApplicationStateBackground when the machine is put to sleep. when the machine is reawakened, it will transition // back to UIApplicationStateInactive (as per the UIKit docs). The OS tends to reactive the app in the usual way if // it happened to be the foreground app when the machine was put to sleep, so it should ultimately work out as expected. // // any registered background tasks are allowed to complete whenever the app switches into UIApplicationStateBackground // mode, so that means that when -terminateApplicationBeforeDate: is called directly, we will wait on background tasks // and also show an alert to the user letting them know what's happening. it also means we attempt to delay machine // sleep whenever sleep is initiated for as long as we can until any pending background tasks are completed. (there is no // alert in that case) this should allow your app time to do any of the usual things like sync with network services or // save state. just as on iOS, there's no guarentee you'll have time to complete you background task and there's no // guarentee that your expiration handler will even be called. additionally, the reliability of your network is certainly // going to be suspect when entering sleep as well. so be aware - but basically these same constraints exist on iOS so // in many respects it shouldn't affect your code much or at all. typedef enum { UIApplicationStateActive, UIApplicationStateInactive, UIApplicationStateBackground } UIApplicationState; typedef NSUInteger UIBackgroundTaskIdentifier; extern const UIBackgroundTaskIdentifier UIBackgroundTaskInvalid; extern const NSTimeInterval UIMinimumKeepAliveTimeout; @class UIWindow, UIApplication, UILocalNotification; @interface UIApplication : UIResponder { @private UIEvent *_currentEvent; UIWindow *_keyWindow; NSMutableSet *_visibleWindows; UIApplicationState _applicationState; __unsafe_unretained id _delegate; BOOL _idleTimerDisabled; BOOL _networkActivityIndicatorVisible; BOOL _applicationSupportsShakeToEdit; NSUInteger _ignoringInteractionEvents; NSInteger _applicationIconBadgeNumber; NSDate *_backgroundTasksExpirationDate; NSMutableArray *_backgroundTasks; } + (UIApplication *)sharedApplication; - (BOOL)sendAction:(SEL)action to:(id)target from:(id)sender forEvent:(UIEvent *)event; - (void)sendEvent:(UIEvent *)event; - (BOOL)openURL:(NSURL *)url; - (BOOL)canOpenURL:(NSURL *)URL; - (void)setStatusBarStyle:(UIStatusBarStyle)statusBarStyle animated:(BOOL)animated; // no effect - (void)beginIgnoringInteractionEvents; - (void)endIgnoringInteractionEvents; - (BOOL)isIgnoringInteractionEvents; - (void)presentLocalNotificationNow:(UILocalNotification *)notification; - (void)cancelLocalNotification:(UILocalNotification *)notification; - (void)cancelAllLocalNotifications; - (UIBackgroundTaskIdentifier)beginBackgroundTaskWithExpirationHandler:(void(^)(void))handler; - (void)endBackgroundTask:(UIBackgroundTaskIdentifier)identifier; @property (nonatomic, readonly) UIWindow *keyWindow; @property (nonatomic, readonly) NSArray *windows; @property (nonatomic, getter=isStatusBarHidden, readonly) BOOL statusBarHidden; @property (nonatomic, readonly) CGRect statusBarFrame; @property (nonatomic, getter=isNetworkActivityIndicatorVisible) BOOL networkActivityIndicatorVisible; // does nothing, always returns NO @property (nonatomic) UIInterfaceOrientation statusBarOrientation; @property (nonatomic, readonly) NSTimeInterval statusBarOrientationAnimationDuration; @property (nonatomic, assign) id delegate; @property (nonatomic, getter=isIdleTimerDisabled) BOOL idleTimerDisabled; // has no actual affect @property (nonatomic) BOOL applicationSupportsShakeToEdit; // no effect @property (nonatomic) UIStatusBarStyle statusBarStyle; // always returns UIStatusBarStyleDefault @property (nonatomic, readonly) UIApplicationState applicationState; // see notes near UIApplicationState struct for details! @property (nonatomic, readonly) NSTimeInterval backgroundTimeRemaining; // always 0 @property (nonatomic) NSInteger applicationIconBadgeNumber; // no effect, but does set/get the number correctly @property (nonatomic, copy) NSArray *scheduledLocalNotifications; // no effect, returns nil @end @interface UIApplication(UIApplicationDeprecated) - (void)setStatusBarHidden:(BOOL)hidden animated:(BOOL)animated __attribute__((deprecated)); // use -setStatusBarHidden:withAnimation: @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIApplication.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIApplication+UIPrivate.h" #import "UIScreen+UIPrivate.h" #import "UIScreenAppKitIntegration.h" #import "UIKitView.h" #import "UIEvent+UIPrivate.h" #import "UITouch+UIPrivate.h" #import "UIWindow+UIPrivate.h" #import "UIPopoverController+UIPrivate.h" #import "UIResponderAppKitIntegration.h" #import "UIApplicationAppKitIntegration.h" #import "UIKey+UIPrivate.h" #import "UIBackgroundTask.h" #import NSString *const UIApplicationWillChangeStatusBarOrientationNotification = @"UIApplicationWillChangeStatusBarOrientationNotification"; NSString *const UIApplicationDidChangeStatusBarOrientationNotification = @"UIApplicationDidChangeStatusBarOrientationNotification"; NSString *const UIApplicationWillEnterForegroundNotification = @"UIApplicationWillEnterForegroundNotification"; NSString *const UIApplicationWillTerminateNotification = @"UIApplicationWillTerminateNotification"; NSString *const UIApplicationWillResignActiveNotification = @"UIApplicationWillResignActiveNotification"; NSString *const UIApplicationDidEnterBackgroundNotification = @"UIApplicationDidEnterBackgroundNotification"; NSString *const UIApplicationDidBecomeActiveNotification = @"UIApplicationDidBecomeActiveNotification"; NSString *const UIApplicationDidFinishLaunchingNotification = @"UIApplicationDidFinishLaunchingNotification"; NSString *const UIApplicationNetworkActivityIndicatorChangedNotification = @"UIApplicationNetworkActivityIndicatorChangedNotification"; NSString *const UIApplicationLaunchOptionsURLKey = @"UIApplicationLaunchOptionsURLKey"; NSString *const UIApplicationLaunchOptionsSourceApplicationKey = @"UIApplicationLaunchOptionsSourceApplicationKey"; NSString *const UIApplicationLaunchOptionsRemoteNotificationKey = @"UIApplicationLaunchOptionsRemoteNotificationKey"; NSString *const UIApplicationLaunchOptionsAnnotationKey = @"UIApplicationLaunchOptionsAnnotationKey"; NSString *const UIApplicationLaunchOptionsLocalNotificationKey = @"UIApplicationLaunchOptionsLocalNotificationKey"; NSString *const UIApplicationLaunchOptionsLocationKey = @"UIApplicationLaunchOptionsLocationKey"; NSString *const UIApplicationDidReceiveMemoryWarningNotification = @"UIApplicationDidReceiveMemoryWarningNotification"; NSString *const UITrackingRunLoopMode = @"UITrackingRunLoopMode"; const UIBackgroundTaskIdentifier UIBackgroundTaskInvalid = NSUIntegerMax; // correct? const NSTimeInterval UIMinimumKeepAliveTimeout = 0; static UIApplication *_theApplication = nil; static CGPoint ScreenLocationFromNSEvent(UIScreen *theScreen, NSEvent *theNSEvent) { CGPoint screenLocation = NSPointToCGPoint([[theScreen UIKitView] convertPoint:[theNSEvent locationInWindow] fromView:nil]); if (![[theScreen UIKitView] isFlipped]) { // the y coord from the NSView might be inverted screenLocation.y = theScreen.bounds.size.height - screenLocation.y - 1; } return screenLocation; } static CGPoint ScrollDeltaFromNSEvent(NSEvent *theNSEvent) { double dx, dy; CGEventRef cgEvent = [theNSEvent CGEvent]; const int64_t isContinious = CGEventGetIntegerValueField(cgEvent, kCGScrollWheelEventIsContinuous); if (isContinious == 0) { CGEventSourceRef source = CGEventCreateSourceFromEvent(cgEvent); double pixelsPerLine; if (source) { pixelsPerLine = CGEventSourceGetPixelsPerLine(source); CFRelease(source); } else { // docs often say things like, "the default is near 10" so it seems reasonable that if the source doesn't work // for some reason to fetch the pixels per line, then 10 is probably a decent fallback value. :) pixelsPerLine = 10; } dx = CGEventGetDoubleValueField(cgEvent, kCGScrollWheelEventFixedPtDeltaAxis2) * pixelsPerLine; dy = CGEventGetDoubleValueField(cgEvent, kCGScrollWheelEventFixedPtDeltaAxis1) * pixelsPerLine; } else { dx = CGEventGetIntegerValueField(cgEvent, kCGScrollWheelEventPointDeltaAxis2); dy = CGEventGetIntegerValueField(cgEvent, kCGScrollWheelEventPointDeltaAxis1); } return CGPointMake(-dx, -dy); } static BOOL TouchIsActiveGesture(UITouch *touch) { return (touch.phase == _UITouchPhaseGestureBegan || touch.phase == _UITouchPhaseGestureChanged); } static BOOL TouchIsActiveNonGesture(UITouch *touch) { return (touch.phase == UITouchPhaseBegan || touch.phase == UITouchPhaseMoved || touch.phase == UITouchPhaseStationary); } static BOOL TouchIsActive(UITouch *touch) { return TouchIsActiveGesture(touch) || TouchIsActiveNonGesture(touch); } @implementation UIApplication @synthesize keyWindow=_keyWindow, delegate=_delegate, idleTimerDisabled=_idleTimerDisabled, applicationSupportsShakeToEdit=_applicationSupportsShakeToEdit; @synthesize applicationIconBadgeNumber = _applicationIconBadgeNumber, applicationState=_applicationState; + (void)initialize { if (self == [UIApplication class]) { _theApplication = [[UIApplication alloc] init]; } } + (UIApplication *)sharedApplication { return _theApplication; } - (id)init { if ((self=[super init])) { _currentEvent = [[UIEvent alloc] initWithEventType:UIEventTypeTouches]; [_currentEvent _setTouch:[[[UITouch alloc] init] autorelease]]; _visibleWindows = [[NSMutableSet alloc] init]; _backgroundTasks = [[NSMutableArray alloc] init]; _applicationState = UIApplicationStateActive; _applicationSupportsShakeToEdit = YES; // yeah... not *really* true, but UIKit defaults to YES :) [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_applicationWillTerminate:) name:NSApplicationWillTerminateNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_applicationWillResignActive:) name:NSApplicationWillResignActiveNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_applicationDidBecomeActive:) name:NSApplicationDidBecomeActiveNotification object:nil]; [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(_applicationWillResignActive:) name:NSWorkspaceScreensDidSleepNotification object:nil]; [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(_applicationDidBecomeActive:) name:NSWorkspaceScreensDidWakeNotification object:nil]; [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(_computerWillSleep:) name:NSWorkspaceWillSleepNotification object:nil]; [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(_computerDidWakeUp:) name:NSWorkspaceDidWakeNotification object:nil]; } return self; } - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; [[[NSWorkspace sharedWorkspace] notificationCenter] removeObserver:self]; [_currentEvent release]; [_visibleWindows release]; [_backgroundTasks release]; [_backgroundTasksExpirationDate release]; [super dealloc]; } - (NSTimeInterval)statusBarOrientationAnimationDuration { return 0.3; } - (BOOL)isStatusBarHidden { return YES; } - (CGRect)statusBarFrame { return CGRectZero; } - (NSTimeInterval)backgroundTimeRemaining { return [_backgroundTasksExpirationDate timeIntervalSinceNow]; } - (BOOL)isNetworkActivityIndicatorVisible { return _networkActivityIndicatorVisible; } - (void)setNetworkActivityIndicatorVisible:(BOOL)b { if (b != [self isNetworkActivityIndicatorVisible]) { _networkActivityIndicatorVisible = b; [[NSNotificationCenter defaultCenter] postNotificationName:UIApplicationNetworkActivityIndicatorChangedNotification object:self]; } } - (void)beginIgnoringInteractionEvents { _ignoringInteractionEvents++; } - (void)endIgnoringInteractionEvents { _ignoringInteractionEvents--; } - (BOOL)isIgnoringInteractionEvents { return (_ignoringInteractionEvents > 0); } - (UIInterfaceOrientation)statusBarOrientation { return UIInterfaceOrientationPortrait; } - (void)setStatusBarOrientation:(UIInterfaceOrientation)orientation { } - (UIStatusBarStyle)statusBarStyle { return UIStatusBarStyleDefault; } - (void)setStatusBarStyle:(UIStatusBarStyle)statusBarStyle { } - (void)setStatusBarStyle:(UIStatusBarStyle)statusBarStyle animated:(BOOL)animated { } - (void)presentLocalNotificationNow:(UILocalNotification *)notification { } - (void)cancelAllLocalNotifications { } - (void)cancelLocalNotification:(UILocalNotification *)notification { } - (NSArray *)scheduledLocalNotifications { return nil; } - (void)setScheduledLocalNotifications:(NSArray *)scheduledLocalNotifications { } - (UIBackgroundTaskIdentifier)beginBackgroundTaskWithExpirationHandler:(void(^)(void))handler { UIBackgroundTask *task = [[[UIBackgroundTask alloc] initWithExpirationHandler:handler] autorelease]; [_backgroundTasks addObject:task]; return task.taskIdentifier; } - (void)endBackgroundTask:(UIBackgroundTaskIdentifier)identifier { for (UIBackgroundTask *task in _backgroundTasks) { if (task.taskIdentifier == identifier) { [_backgroundTasks removeObject:task]; break; } } } - (BOOL)_enterBackground { if (self.applicationState != UIApplicationStateBackground) { _applicationState = UIApplicationStateBackground; if ([_delegate respondsToSelector:@selector(applicationDidEnterBackground:)]) { [_delegate applicationDidEnterBackground:self]; } [[NSNotificationCenter defaultCenter] postNotificationName:UIApplicationDidEnterBackgroundNotification object:self]; return YES; } else { return NO; } } - (void)_enterForeground { if (self.applicationState == UIApplicationStateBackground) { if ([_delegate respondsToSelector:@selector(applicationWillEnterForeground:)]) { [_delegate applicationWillEnterForeground:self]; } [[NSNotificationCenter defaultCenter] postNotificationName:UIApplicationWillEnterForegroundNotification object:self]; _applicationState = UIApplicationStateInactive; } } - (BOOL)_runRunLoopForBackgroundTasksBeforeDate:(NSDate *)date { // check if all tasks were done, and if so, break if ([_backgroundTasks count] == 0) { return NO; } // run the runloop in the default mode so things like connections and timers still work for processing our // background tasks. we'll make sure not to run this any longer than 1 second at a time, otherwise the alert // might hang around for a lot longer than is necessary since we might not have anything to run in the default // mode for awhile or something which would keep this method from returning. [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:date]; // otherwise check if we've timed out and if we are, break if ([[NSDate date] timeIntervalSinceReferenceDate] >= [_backgroundTasksExpirationDate timeIntervalSinceReferenceDate]) { return NO; } return YES; } - (void)_cancelBackgroundTasks { // if there's any remaining tasks, run their expiration handlers for (UIBackgroundTask *task in [[_backgroundTasks copy] autorelease]) { if (task.expirationHandler) { task.expirationHandler(); } } // remove any lingering tasks so we're back to being empty [_backgroundTasks removeAllObjects]; } - (void)_runBackgroundTasks:(void (^)(void))run_tasks { run_tasks(); } - (NSApplicationTerminateReply)terminateApplicationBeforeDate:(NSDate *)timeoutDate { [self _enterBackground]; [_backgroundTasksExpirationDate release]; _backgroundTasksExpirationDate = [timeoutDate retain]; // we will briefly block here for a short time and run the runloop in an attempt to let the background tasks finish up before // actually prompting the user with an annoying alert. users are much more used to an app hanging for a brief moment while // quitting than they are with an alert appearing/disappearing suddenly that they might have had trouble reading and processing // before it's gone. that sort of thing creates anxiety. NSDate *blockingBackgroundExpiration = [NSDate dateWithTimeIntervalSinceNow:1.33]; for (;;) { if (![self _runRunLoopForBackgroundTasksBeforeDate:blockingBackgroundExpiration] || [NSDate timeIntervalSinceReferenceDate] >= [blockingBackgroundExpiration timeIntervalSinceReferenceDate]) { break; } } // if it turns out we're all done with tasks (or maybe had none to begin with), we'll clean up the structures // and tell our app we can terminate immediately now. if ([_backgroundTasks count] == 0) { [self _cancelBackgroundTasks]; // and reset our timer since we're done [_backgroundTasksExpirationDate release]; _backgroundTasksExpirationDate = nil; // and return return NSTerminateNow; } // otherwise... we have to do a deferred thing so we can show an alert while we wait for background tasks to finish... void (^taskFinisher)(void) = ^{ NSAlert *alert = [[NSAlert alloc] init]; [alert setAlertStyle:NSInformationalAlertStyle]; [alert setShowsSuppressionButton:NO]; [alert setMessageText:@"Quitting"]; [alert setInformativeText:@"Finishing some tasks..."]; [alert addButtonWithTitle:@"Quit Now"]; [alert layout]; // to avoid upsetting the user with an alert that flashes too quickly to read, we'll later artifically ensure that // the alert has been visible for at least some small amount of time to give them a chance to see and understand it. NSDate *minimumDisplayTime = [NSDate dateWithTimeIntervalSinceNow:2.33]; NSModalSession session = [NSApp beginModalSessionForWindow:alert.window]; // run the runloop and wait for tasks to finish while ([NSApp runModalSession:session] == NSRunContinuesResponse) { if (![self _runRunLoopForBackgroundTasksBeforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]) { break; } } // when we exit the runloop loop, then we're done with the tasks. either they are all finished or the time has run out // so we need to clean things up here as if we're all finished. if there's any remaining tasks, run their expiration handlers [self _cancelBackgroundTasks]; // and reset our timer since we're done [_backgroundTasksExpirationDate release]; _backgroundTasksExpirationDate = nil; // now just in case all of this happened too quickly and the user might not have had time to read and understand the alert, // we will kill some time for a bit as long as the alert is still visible. runModalSession: will not return NSRunContinuesResponse // if the user closed the alert, so in that case then this delay won't happen at all. however if the tasks finished too quickly // then what this does is kill time until the user clicks the quit button or the timer expires. while ([NSApp runModalSession:session] == NSRunContinuesResponse) { if ([NSDate timeIntervalSinceReferenceDate] >= [minimumDisplayTime timeIntervalSinceReferenceDate]) { break; } } [alert release]; [NSApp endModalSession:session]; // tell the real NSApp we're all done here [NSApp replyToApplicationShouldTerminate:YES]; }; // I need to delay this but run it on the main thread and also be able to run it in the panel run loop mode // because we're probably in that run loop mode due to how -applicationShouldTerminate: does things. I don't // know if I could do this same thing with a couple of simple GCD calls, but whatever, this works too. :) [self performSelectorOnMainThread:@selector(_runBackgroundTasks:) withObject:[[taskFinisher copy] autorelease] waitUntilDone:NO modes:[NSArray arrayWithObjects:NSModalPanelRunLoopMode, NSRunLoopCommonModes, nil]]; return NSTerminateLater; } - (void)_computerWillSleep:(NSNotification *)note { if ([self _enterBackground]) { // docs say we have 30 seconds to return from our handler for the sleep notification, so we'll let background tasks // take up to 29 of them with the idea that hopefully this means that any cancelation handlers that might need to run // have a full second or so to finish up before we're forced to sleep. // since we can just block here we don't need to put the app into a modal state or popup a window or anything because // the machine is about to go to sleep.. so we'll just do things in a blocking way in this case while still handling // any pending background tasks. [_backgroundTasksExpirationDate release]; _backgroundTasksExpirationDate = [[NSDate alloc] initWithTimeIntervalSinceNow:29]; for (;;) { if (![self _runRunLoopForBackgroundTasksBeforeDate:_backgroundTasksExpirationDate]) { break; } } [self _cancelBackgroundTasks]; // and reset our timer since we're done [_backgroundTasksExpirationDate release]; _backgroundTasksExpirationDate = nil; } } - (void)_computerDidWakeUp:(NSNotification *)note { [self _enterForeground]; } - (void)_setKeyWindow:(UIWindow *)newKeyWindow { _keyWindow = newKeyWindow; if (_keyWindow) { // this will make the NSView that the key window lives on the first responder in its NSWindow // highly confusing, but I think this is mostly the correct thing to do // when a UIView is made first responder, it also tells its window to become the key window // which means that we can ultimately end up here and if keyboard stuff is to work as expected // (for example) the underlying NSView really needs to be the first responder as far as AppKit // is concerned. this is all very confusing in my mind right now, but I think it makes sense. [[[_keyWindow.screen UIKitView] window] makeFirstResponder:[_keyWindow.screen UIKitView]]; } } - (void)_windowDidBecomeVisible:(UIWindow *)theWindow { [_visibleWindows addObject:[NSValue valueWithNonretainedObject:theWindow]]; } - (void)_windowDidBecomeHidden:(UIWindow *)theWindow { if (theWindow == _keyWindow) [self _setKeyWindow:nil]; [_visibleWindows removeObject:[NSValue valueWithNonretainedObject:theWindow]]; } - (NSArray *)windows { NSSortDescriptor *sort = [[[NSSortDescriptor alloc] initWithKey:@"windowLevel" ascending:YES] autorelease]; return [[_visibleWindows valueForKey:@"nonretainedObjectValue"] sortedArrayUsingDescriptors:[NSArray arrayWithObject:sort]]; } - (BOOL)sendAction:(SEL)action to:(id)target from:(id)sender forEvent:(UIEvent *)event { if (!target) { // The docs say this method will start with the first responder if target==nil. Initially I thought this meant that there was always a given // or set first responder (attached to the window, probably). However it doesn't appear that is the case. Instead it seems UIKit is perfectly // happy to function without ever having any UIResponder having had a becomeFirstResponder sent to it. This method seems to work by starting // with sender and traveling down the responder chain from there if target==nil. The first object that responds to the given action is sent // the message. (or no one is) // My confusion comes from the fact that motion events and keyboard events are supposed to start with the first responder - but what is that // if none was ever set? Apparently the answer is, if none were set, the message doesn't get delivered. If you expicitly set a UIResponder // using becomeFirstResponder, then it will receive keyboard/motion events but it does not receive any other messages from other views that // happen to end up calling this method with a nil target. So that's a seperate mechanism and I think it's confused a bit in the docs. // It seems that the reality of message delivery to "first responder" is that it depends a bit on the source. If the source is an external // event like motion or keyboard, then there has to have been an explicitly set first responder (by way of becomeFirstResponder) in order for // those events to even get delivered at all. If there is no responder defined, the action is simply never sent and thus never received. // This is entirely independent of what "first responder" means in the context of a UIControl. Instead, for a UIControl, the first responder // is the first UIResponder (including the UIControl itself) that responds to the action. It starts with the UIControl (sender) and not with // whatever UIResponder may have been set with becomeFirstResponder. id responder = sender; while (responder) { if ([responder respondsToSelector:action]) { target = responder; break; } else if ([responder respondsToSelector:@selector(nextResponder)]) { responder = [responder nextResponder]; } else { responder = nil; } } } if (target) { [target performSelector:action withObject:sender withObject:event]; return YES; } else { return NO; } } - (UIResponder *)_firstResponderForScreen:(UIScreen *)screen { if (_keyWindow.screen == screen) { return [_keyWindow _firstResponder]; } else { return nil; } } - (BOOL)_sendActionToFirstResponder:(SEL)action withSender:(id)sender fromScreen:(UIScreen *)theScreen { UIResponder *responder = [self _firstResponderForScreen:theScreen]; while (responder) { if ([responder respondsToSelector:action]) { [responder performSelector:action withObject:sender]; return YES; } else { responder = [responder nextResponder]; } } return NO; } - (BOOL)_firstResponderCanPerformAction:(SEL)action withSender:(id)sender fromScreen:(UIScreen *)theScreen { return [[self _firstResponderForScreen:theScreen] canPerformAction:action withSender:sender]; } - (void)sendEvent:(UIEvent *)event { for (UITouch *touch in [event allTouches]) { [touch.window sendEvent:event]; } } - (BOOL)openURL:(NSURL *)url { return url? [[NSWorkspace sharedWorkspace] openURL:url] : NO; } - (BOOL)canOpenURL:(NSURL *)url { return (url? [[NSWorkspace sharedWorkspace] URLForApplicationToOpenURL:url] : nil) != nil; } - (BOOL)_sendGlobalKeyboardNSEvent:(NSEvent *)theNSEvent fromScreen:(UIScreen *)theScreen { if (![self isIgnoringInteractionEvents]) { UIKey *key = [[[UIKey alloc] initWithNSEvent:theNSEvent] autorelease]; if (key.type == UIKeyTypeEnter || (key.commandKeyPressed && key.type == UIKeyTypeReturn)) { if ([self _firstResponderCanPerformAction:@selector(commit:) withSender:key fromScreen:theScreen]) { return [self _sendActionToFirstResponder:@selector(commit:) withSender:key fromScreen:theScreen]; } } } return NO; } - (BOOL)_sendKeyboardNSEvent:(NSEvent *)theNSEvent fromScreen:(UIScreen *)theScreen { if (![self isIgnoringInteractionEvents]) { if (![self _sendGlobalKeyboardNSEvent:theNSEvent fromScreen:theScreen]) { UIResponder *firstResponder = [self _firstResponderForScreen:theScreen]; if (firstResponder) { UIKey *key = [[[UIKey alloc] initWithNSEvent:theNSEvent] autorelease]; UIEvent *event = [[[UIEvent alloc] initWithEventType:UIEventTypeKeyPress] autorelease]; [event _setTimestamp:[theNSEvent timestamp]]; [firstResponder keyPressed:key withEvent:event]; return ![event _isUnhandledKeyPressEvent]; } } } return NO; } - (void)_setCurrentEventTouchedViewWithNSEvent:(NSEvent *)theNSEvent fromScreen:(UIScreen *)theScreen { const CGPoint screenLocation = ScreenLocationFromNSEvent(theScreen, theNSEvent); UITouch *touch = [[_currentEvent allTouches] anyObject]; UIView *previousView = [touch.view retain]; [touch _setTouchedView:[theScreen _hitTest:screenLocation event:_currentEvent]]; if (touch.view != previousView) { [previousView mouseExitedView:previousView enteredView:touch.view withEvent:_currentEvent]; [touch.view mouseExitedView:previousView enteredView:touch.view withEvent:_currentEvent]; } [previousView release]; } - (void)_sendMouseNSEvent:(NSEvent *)theNSEvent fromScreen:(UIScreen *)theScreen { UITouch *touch = [[_currentEvent allTouches] anyObject]; [_currentEvent _setTimestamp:[theNSEvent timestamp]]; const NSTimeInterval timestamp = [theNSEvent timestamp]; const CGPoint screenLocation = ScreenLocationFromNSEvent(theScreen, theNSEvent); // this is a special case to cancel any existing gestures (as far as the client code is concerned) if a mouse // button is pressed mid-gesture. the reason is that sometimes when using a magic mouse a user will intend to // click but if their finger moves against the surface ever so slightly, it will trigger a touch gesture to // begin instead. without this, the fact that we're in a touch gesture phase effectively overrules everything // else and clicks end up not getting registered. I don't think it's right to allow clicks to pass through when // we're in a gesture state since that'd be somewhat like a multitouch scenerio on a real iOS device and we're // not supporting anything like that at the moment. if (TouchIsActiveGesture(touch) && ([theNSEvent type] == NSLeftMouseDown || [theNSEvent type] == NSRightMouseDown)) { [touch _updatePhase:_UITouchPhaseGestureEnded screenLocation:screenLocation timestamp:timestamp]; [self sendEvent:_currentEvent]; } if (TouchIsActiveNonGesture(touch)) { switch ([theNSEvent type]) { case NSLeftMouseUp: [touch _updatePhase:UITouchPhaseEnded screenLocation:screenLocation timestamp:timestamp]; [self sendEvent:_currentEvent]; break; case NSLeftMouseDragged: [touch _updatePhase:UITouchPhaseMoved screenLocation:screenLocation timestamp:timestamp]; [self sendEvent:_currentEvent]; break; } } else if (TouchIsActiveGesture(touch)) { switch ([theNSEvent type]) { case NSEventTypeEndGesture: [touch _updatePhase:_UITouchPhaseGestureEnded screenLocation:screenLocation timestamp:timestamp]; [self sendEvent:_currentEvent]; break; case NSScrollWheel: // when captured here, the scroll wheel event had to have been part of a gesture - in other words it is a // touch device scroll event and is therefore mapped to UIPanGestureRecognizer. [touch _updateGesture:_UITouchGesturePan screenLocation:screenLocation delta:ScrollDeltaFromNSEvent(theNSEvent) rotation:0 magnification:0 timestamp:timestamp]; [self sendEvent:_currentEvent]; break; case NSEventTypeMagnify: [touch _updateGesture:_UITouchGesturePinch screenLocation:screenLocation delta:CGPointZero rotation:0 magnification:[theNSEvent magnification] timestamp:timestamp]; [self sendEvent:_currentEvent]; break; case NSEventTypeRotate: [touch _updateGesture:_UITouchGestureRotation screenLocation:screenLocation delta:CGPointZero rotation:[theNSEvent rotation] magnification:0 timestamp:timestamp]; [self sendEvent:_currentEvent]; break; case NSEventTypeSwipe: [touch _updateGesture:_UITouchGestureSwipe screenLocation:screenLocation delta:ScrollDeltaFromNSEvent(theNSEvent) rotation:0 magnification:0 timestamp:timestamp]; [self sendEvent:_currentEvent]; break; } } else if (![self isIgnoringInteractionEvents]) { switch ([theNSEvent type]) { case NSLeftMouseDown: [touch _setPhase:UITouchPhaseBegan screenLocation:screenLocation tapCount:[theNSEvent clickCount] timestamp:timestamp]; [self _setCurrentEventTouchedViewWithNSEvent:theNSEvent fromScreen:theScreen]; [self sendEvent:_currentEvent]; break; case NSEventTypeBeginGesture: [touch _setPhase:_UITouchPhaseGestureBegan screenLocation:screenLocation tapCount:0 timestamp:timestamp]; [self _setCurrentEventTouchedViewWithNSEvent:theNSEvent fromScreen:theScreen]; [self sendEvent:_currentEvent]; break; case NSScrollWheel: // we should only get a scroll wheel event down here if it was done on a non-touch device or was the result of a momentum // scroll, so they are treated differently so we can tell them apart later in UIPanGestureRecognizer and UIScrollWheelGestureRecognizer // which are both used by UIScrollView. [touch _setDiscreteGesture:_UITouchDiscreteGestureScrollWheel screenLocation:screenLocation tapCount:0 delta:ScrollDeltaFromNSEvent(theNSEvent) timestamp:timestamp]; [self _setCurrentEventTouchedViewWithNSEvent:theNSEvent fromScreen:theScreen]; [self sendEvent:_currentEvent]; break; case NSRightMouseDown: [touch _setDiscreteGesture:_UITouchDiscreteGestureRightClick screenLocation:screenLocation tapCount:[theNSEvent clickCount] delta:CGPointZero timestamp:timestamp]; [self _setCurrentEventTouchedViewWithNSEvent:theNSEvent fromScreen:theScreen]; [self sendEvent:_currentEvent]; break; case NSMouseMoved: case NSMouseEntered: case NSMouseExited: [touch _setDiscreteGesture:_UITouchDiscreteGestureMouseMove screenLocation:screenLocation tapCount:0 delta:ScrollDeltaFromNSEvent(theNSEvent) timestamp:timestamp]; [self _setCurrentEventTouchedViewWithNSEvent:theNSEvent fromScreen:theScreen]; [self sendEvent:_currentEvent]; break; } } } // this is used to cause an interruption/cancel of the current touches. // Use this when a modal UI element appears (such as a native popup menu), or when a UIPopoverController appears. It seems to make the most sense // to call _cancelTouches *after* the modal menu has been dismissed, as this causes UI elements to remain in their "pushed" state while the menu // is being displayed. If that behavior isn't desired, the simple solution is to present the menu from touchesEnded: instead of touchesBegan:. - (void)_cancelTouches { UITouch *touch = [[_currentEvent allTouches] anyObject]; const BOOL wasActiveTouch = TouchIsActive(touch); [touch _setTouchPhaseCancelled]; if (wasActiveTouch) { [self sendEvent:_currentEvent]; } } // this sets the touches view property to nil (while retaining the window property setting) // this is used when a view is removed from its superview while it may have been the origin // of an active touch. after a view is removed, we don't want to deliver any more touch events // to it, but we still may need to route the touch itself for the sake of gesture recognizers // so we need to retain the touch's original window setting so that events can still be routed. // // note that the touch itself is not being cancelled here so its phase remains unchanged. // I'm not entirely certain if that's the correct thing to do, but I think it makes sense. The // touch itself has not gone anywhere - just the view that it first touched. That breaks the // delivery of the touch events themselves as far as the usual responder chain delivery is // concerned, but that appears to be what happens in the real UIKit when you remove a view out // from under an active touch. // // this whole thing is necessary because otherwise a gesture which may have been initiated over // some specific view would end up getting cancelled/failing if the view under it happens to be // removed. this is more common than you might expect. a UITableView that is not reusing rows // does exactly this as it scrolls - which coincidentally is how I found this bug in the first // place. :P - (void)_removeViewFromTouches:(UIView *)aView { for (UITouch *touch in [_currentEvent allTouches]) { if (touch.view == aView) { [touch _removeFromView]; } } } - (void)_applicationWillTerminate:(NSNotification *)note { if ([_delegate respondsToSelector:@selector(applicationWillTerminate:)]) { [_delegate applicationWillTerminate:self]; } [[NSNotificationCenter defaultCenter] postNotificationName:UIApplicationWillTerminateNotification object:self]; } - (void)_applicationWillResignActive:(NSNotification *)note { if (self.applicationState == UIApplicationStateActive) { if ([_delegate respondsToSelector:@selector(applicationWillResignActive:)]) { [_delegate applicationWillResignActive:self]; } [[NSNotificationCenter defaultCenter] postNotificationName:UIApplicationWillResignActiveNotification object:self]; _applicationState = UIApplicationStateInactive; } } - (void)_applicationDidBecomeActive:(NSNotification *)note { if (self.applicationState == UIApplicationStateInactive) { _applicationState = UIApplicationStateActive; if ([_delegate respondsToSelector:@selector(applicationDidBecomeActive:)]) { [_delegate applicationDidBecomeActive:self]; } [[NSNotificationCenter defaultCenter] postNotificationName:UIApplicationDidBecomeActiveNotification object:self]; } } @end @implementation UIApplication(UIApplicationDeprecated) - (void)setStatusBarHidden:(BOOL)hidden animated:(BOOL)animated { } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIApplicationAppKitIntegration.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIApplication.h" #import extern NSString *const UIApplicationNetworkActivityIndicatorChangedNotification; @interface UIApplication (AppKitIntegration) // the -terminateApplicationBeforeDate: method will switch the UIApplication to the background state // and put the NSApplication into a modal state and present an alert to the user with a "Quit Now" button. // then it will allow any background tasks registered with UIApplcation (if any) to finish. // if time expires before they finish, their expiration handlers will be called instead. // once this is finished waiting/expiring stuff, it will run [NSApp replyToApplicationShouldTerminate:YES]; // if there's no background tasks to run after transitioning UIApplication to the background state, it will // return NSTerminateNow and there will be no modal alerts presented to the user. otherwise it returns NSTerminateLater. // this is intended to be run from NSApplicationDelegate's -applicationShouldTerminate: method like this: /* - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender { return [[UIApplication sharedApplication] terminateApplicationBeforeDate:[NSDate dateWithTimeIntervalSinceNow:30]]; } */ - (NSApplicationTerminateReply)terminateApplicationBeforeDate:(NSDate *)timeoutDate; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIApplicationDelegate.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @class UIApplication; @protocol UIApplicationDelegate @optional - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions; - (void)applicationDidFinishLaunching:(UIApplication *)application; - (void)applicationDidBecomeActive:(UIApplication *)application; - (void)applicationWillResignActive:(UIApplication *)application; - (void)applicationWillTerminate:(UIApplication *)application; - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation; - (void)applicationDidEnterBackground:(UIApplication *)application; - (void)applicationWillEnterForeground:(UIApplication *)application; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIBackgroundTask.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIApplication.h" @interface UIBackgroundTask : NSObject { void (^_expirationHandler)(void); UIBackgroundTaskIdentifier _taskIdentifier; } - (id)initWithExpirationHandler:(void(^)(void))handler; @property (nonatomic, readonly) void (^expirationHandler)(void); @property (nonatomic, readonly) UIBackgroundTaskIdentifier taskIdentifier; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIBackgroundTask.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIBackgroundTask.h" @implementation UIBackgroundTask @synthesize expirationHandler=_expirationHandler, taskIdentifier=_taskIdentifier; - (id)initWithExpirationHandler:(void(^)(void))handler { if ((self = [super init])) { _expirationHandler = [handler copy]; _taskIdentifier = [self hash]; // may not be the best idea in the world } return self; } - (void)dealloc { [_expirationHandler release]; [super dealloc]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIBarButtonItem.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIBarItem.h" typedef enum { UIBarButtonSystemItemDone, UIBarButtonSystemItemCancel, UIBarButtonSystemItemEdit, UIBarButtonSystemItemSave, UIBarButtonSystemItemAdd, UIBarButtonSystemItemFlexibleSpace, UIBarButtonSystemItemFixedSpace, UIBarButtonSystemItemCompose, UIBarButtonSystemItemReply, UIBarButtonSystemItemAction, UIBarButtonSystemItemOrganize, UIBarButtonSystemItemBookmarks, UIBarButtonSystemItemSearch, UIBarButtonSystemItemRefresh, UIBarButtonSystemItemStop, UIBarButtonSystemItemCamera, UIBarButtonSystemItemTrash, UIBarButtonSystemItemPlay, UIBarButtonSystemItemPause, UIBarButtonSystemItemRewind, UIBarButtonSystemItemFastForward, UIBarButtonSystemItemUndo, // iPhoneOS 3.0 UIBarButtonSystemItemRedo, // iPhoneOS 3.0 } UIBarButtonSystemItem; typedef enum { UIBarButtonItemStylePlain, UIBarButtonItemStyleBordered, UIBarButtonItemStyleDone, } UIBarButtonItemStyle; @class UIView, UIImage; @interface UIBarButtonItem : UIBarItem { @package CGFloat _width; UIView *_customView; __unsafe_unretained id _target; SEL _action; BOOL _isSystemItem; UIBarButtonSystemItem _systemItem; UIBarButtonItemStyle _style; } - (id)initWithBarButtonSystemItem:(UIBarButtonSystemItem)systemItem target:(id)target action:(SEL)action; - (id)initWithCustomView:(UIView *)customView; - (id)initWithTitle:(NSString *)title style:(UIBarButtonItemStyle)style target:(id)target action:(SEL)action; - (id)initWithImage:(UIImage *)image style:(UIBarButtonItemStyle)style target:(id)target action:(SEL)action; @property (nonatomic) UIBarButtonItemStyle style; @property (nonatomic) CGFloat width; @property (nonatomic, strong) UIView *customView; @property (nonatomic, assign) id target; @property (nonatomic) SEL action; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIBarButtonItem.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIBarButtonItem.h" #import "UIView.h" @implementation UIBarButtonItem @synthesize width=_width, customView=_customView, action=_action, target=_target, style=_style; - (id)init { if ((self=[super init])) { _isSystemItem = NO; self.style = UIBarButtonItemStylePlain; } return self; } - (id)initWithBarButtonSystemItem:(UIBarButtonSystemItem)systemItem target:(id)target action:(SEL)action { if ((self=[self init])) { _isSystemItem = YES; _systemItem = systemItem; self.target = target; self.action = action; } return self; } - (id)initWithCustomView:(UIView *)customView { if ((self=[self init])) { self.customView = customView; } return self; } - (id)initWithTitle:(NSString *)title style:(UIBarButtonItemStyle)style target:(id)target action:(SEL)action { if ((self=[self init])) { self.title = title; self.style = style; self.target = target; self.action = action; } return self; } - (id)initWithImage:(UIImage *)image style:(UIBarButtonItemStyle)style target:(id)target action:(SEL)action { if ((self=[self init])) { self.image = image; self.style = style; self.target = target; self.action = action; } return self; } - (void)dealloc { [_customView release]; [super dealloc]; } - (UIView *)customView { return _isSystemItem? nil : _customView; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIBarItem.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIControl.h" @class UIImage; @interface UIBarItem : NSObject { @private BOOL _enabled; UIImage *_image; UIEdgeInsets _imageInsets; NSString *_title; NSInteger _tag; } @property (nonatomic, getter=isEnabled) BOOL enabled; @property (nonatomic, strong) UIImage *image; @property (nonatomic, assign) UIEdgeInsets imageInsets; @property (nonatomic, copy) NSString *title; @property (nonatomic) NSInteger tag; - (void)setTitleTextAttributes:(NSDictionary *)attributes forState:(UIControlState)state; - (NSDictionary *)titleTextAttributesForState:(UIControlState)state; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIBarItem.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIBarItem.h" #import "UIImage.h" @implementation UIBarItem @synthesize enabled=_enabled, image=_image, imageInsets=_imageInsets, title=_title, tag=_tag; - (id)init { if ((self = [super init])) { self.enabled = YES; self.imageInsets = UIEdgeInsetsZero; } return self; } - (void)dealloc { [_image release]; [_title release]; [super dealloc]; } - (void)setTitleTextAttributes:(NSDictionary *)attributes forState:(UIControlState)state { } - (NSDictionary *)titleTextAttributesForState:(UIControlState)state { return nil; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIBezierPath.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import enum { UIRectCornerTopLeft = 1 << 0, UIRectCornerTopRight = 1 << 1, UIRectCornerBottomLeft = 1 << 2, UIRectCornerBottomRight = 1 << 3, UIRectCornerAllCorners = ~0 }; typedef NSUInteger UIRectCorner; @interface UIBezierPath : NSObject { @private CGPathRef _path; CGFloat _lineWidth; CGLineCap _lineCapStyle; CGLineJoin _lineJoinStyle; CGFloat _miterLimit; CGFloat _flatness; BOOL _usesEvenOddFillRule; CGFloat *_lineDashPattern; NSInteger _lineDashCount; CGFloat _lineDashPhase; } + (UIBezierPath *)bezierPath; + (UIBezierPath *)bezierPathWithRect:(CGRect)rect; + (UIBezierPath *)bezierPathWithOvalInRect:(CGRect)rect; + (UIBezierPath *)bezierPathWithRoundedRect:(CGRect)rect cornerRadius:(CGFloat)cornerRadius; + (UIBezierPath *)bezierPathWithRoundedRect:(CGRect)rect byRoundingCorners:(UIRectCorner)corners cornerRadii:(CGSize)cornerRadii; + (UIBezierPath *)bezierPathWithArcCenter:(CGPoint)center radius:(CGFloat)radius startAngle:(CGFloat)startAngle endAngle:(CGFloat)endAngle clockwise:(BOOL)clockwise; + (UIBezierPath *)bezierPathWithCGPath:(CGPathRef)CGPath; - (void)moveToPoint:(CGPoint)point; - (void)addLineToPoint:(CGPoint)point; - (void)addArcWithCenter:(CGPoint)center radius:(CGFloat)radius startAngle:(CGFloat)startAngle endAngle:(CGFloat)endAngle clockwise:(BOOL)clockwise; - (void)addCurveToPoint:(CGPoint)endPoint controlPoint1:(CGPoint)controlPoint1 controlPoint2:(CGPoint)controlPoint2; - (void)addQuadCurveToPoint:(CGPoint)endPoint controlPoint:(CGPoint)controlPoint; - (void)closePath; - (void)removeAllPoints; - (void)appendPath:(UIBezierPath *)bezierPath; @property (nonatomic) CGPathRef CGPath; @property (nonatomic, readonly) CGPoint currentPoint; @property (nonatomic) CGFloat lineWidth; @property (nonatomic) CGLineCap lineCapStyle; @property (nonatomic) CGLineJoin lineJoinStyle; @property (nonatomic) CGFloat miterLimit; @property (nonatomic) CGFloat flatness; @property (nonatomic) BOOL usesEvenOddFillRule; - (void)setLineDash:(const CGFloat *)pattern count:(NSInteger)count phase:(CGFloat)phase; - (void)getLineDash:(CGFloat *)pattern count:(NSInteger *)count phase:(CGFloat *)phase; - (void)fill; - (void)fillWithBlendMode:(CGBlendMode)blendMode alpha:(CGFloat)alpha; - (void)stroke; - (void)strokeWithBlendMode:(CGBlendMode)blendMode alpha:(CGFloat)alpha; - (void)addClip; - (BOOL)containsPoint:(CGPoint)point; @property (readonly, getter=isEmpty) BOOL empty; @property (nonatomic, readonly) CGRect bounds; - (void)applyTransform:(CGAffineTransform)transform; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIBezierPath.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIBezierPath.h" #import "UIGraphics.h" @implementation UIBezierPath @synthesize lineWidth=_lineWidth, lineCapStyle=_lineCapStyle, lineJoinStyle=_lineJoinStyle, miterLimit=_miterLimit; @synthesize flatness=_flatness, usesEvenOddFillRule=_usesEvenOddFillRule, CGPath=_path; - (id)init { if ((self=[super init])) { _lineWidth = 1; _lineCapStyle = kCGLineCapButt; _lineJoinStyle = kCGLineJoinMiter; _miterLimit = 10; _flatness = 0.6; _usesEvenOddFillRule = NO; _lineDashPattern = NULL; _lineDashCount = 0; _lineDashPhase = 0; } return self; } - (void)dealloc { if (_path) CGPathRelease(_path); [super dealloc]; } + (UIBezierPath *)bezierPathWithCGPath:(CGPathRef)CGPath { NSAssert(CGPath != NULL, @"CGPath must not be NULL"); UIBezierPath *bezierPath = [[self alloc] init]; bezierPath.CGPath = CGPath; return [bezierPath autorelease]; } + (UIBezierPath *)bezierPath { UIBezierPath *bezierPath = [[self alloc] init]; bezierPath->_path = CGPathCreateMutable(); return [bezierPath autorelease]; } + (UIBezierPath *)bezierPathWithRect:(CGRect)rect { CGMutablePathRef path = CGPathCreateMutable(); CGPathAddRect(path, NULL, rect); UIBezierPath *bezierPath = [[self alloc] init]; bezierPath->_path = path; return [bezierPath autorelease]; } + (UIBezierPath *)bezierPathWithOvalInRect:(CGRect)rect { CGMutablePathRef path = CGPathCreateMutable(); CGPathAddEllipseInRect(path, NULL, rect); UIBezierPath *bezierPath = [[self alloc] init]; bezierPath->_path = path; return [bezierPath autorelease]; } + (UIBezierPath *)bezierPathWithRoundedRect:(CGRect)rect cornerRadius:(CGFloat)cornerRadius { return [self bezierPathWithRoundedRect:rect byRoundingCorners:UIRectCornerAllCorners cornerRadii:CGSizeMake(cornerRadius,cornerRadius)]; } + (UIBezierPath *)bezierPathWithRoundedRect:(CGRect)rect byRoundingCorners:(UIRectCorner)corners cornerRadii:(CGSize)cornerRadii { CGMutablePathRef path = CGPathCreateMutable(); const CGPoint topLeft = rect.origin; const CGPoint topRight = CGPointMake(CGRectGetMaxX(rect), CGRectGetMinY(rect)); const CGPoint bottomRight = CGPointMake(CGRectGetMaxX(rect), CGRectGetMaxY(rect)); const CGPoint bottomLeft = CGPointMake(CGRectGetMinX(rect), CGRectGetMaxY(rect)); if (corners & UIRectCornerTopLeft) { CGPathMoveToPoint(path, NULL, topLeft.x+cornerRadii.width, topLeft.y); } else { CGPathMoveToPoint(path, NULL, topLeft.x, topLeft.y); } if (corners & UIRectCornerTopRight) { CGPathAddLineToPoint(path, NULL, topRight.x-cornerRadii.width, topRight.y); CGPathAddCurveToPoint(path, NULL, topRight.x, topRight.y, topRight.x, topRight.y+cornerRadii.height, topRight.x, topRight.y+cornerRadii.height); } else { CGPathAddLineToPoint(path, NULL, topRight.x, topRight.y); } if (corners & UIRectCornerBottomRight) { CGPathAddLineToPoint(path, NULL, bottomRight.x, bottomRight.y-cornerRadii.height); CGPathAddCurveToPoint(path, NULL, bottomRight.x, bottomRight.y, bottomRight.x-cornerRadii.width, bottomRight.y, bottomRight.x-cornerRadii.width, bottomRight.y); } else { CGPathAddLineToPoint(path, NULL, bottomRight.x, bottomRight.y); } if (corners & UIRectCornerBottomLeft) { CGPathAddLineToPoint(path, NULL, bottomLeft.x+cornerRadii.width, bottomLeft.y); CGPathAddCurveToPoint(path, NULL, bottomLeft.x, bottomLeft.y, bottomLeft.x, bottomLeft.y-cornerRadii.height, bottomLeft.x, bottomLeft.y-cornerRadii.height); } else { CGPathAddLineToPoint(path, NULL, bottomLeft.x, bottomLeft.y); } if (corners & UIRectCornerTopLeft) { CGPathAddLineToPoint(path, NULL, topLeft.x, topLeft.y+cornerRadii.height); CGPathAddCurveToPoint(path, NULL, topLeft.x, topLeft.y, topLeft.x+cornerRadii.width, topLeft.y, topLeft.x+cornerRadii.width, topLeft.y); } else { CGPathAddLineToPoint(path, NULL, topLeft.x, topLeft.y); } CGPathCloseSubpath(path); UIBezierPath *bezierPath = [[self alloc] init]; bezierPath->_path = path; return [bezierPath autorelease]; } + (UIBezierPath *)bezierPathWithArcCenter:(CGPoint)center radius:(CGFloat)radius startAngle:(CGFloat)startAngle endAngle:(CGFloat)endAngle clockwise:(BOOL)clockwise { CGMutablePathRef path = CGPathCreateMutable(); CGPathAddArc(path, NULL, center.x, center.y, radius, startAngle, endAngle, clockwise); UIBezierPath *bezierPath = [[self alloc] init]; bezierPath->_path = path; return [bezierPath autorelease]; } - (void)moveToPoint:(CGPoint)point { CGMutablePathRef mutablePath = CGPathCreateMutableCopy(_path); CGPathMoveToPoint(mutablePath, NULL, point.x, point.y); self.CGPath = mutablePath; CGPathRelease(mutablePath); } - (void)addLineToPoint:(CGPoint)point { CGMutablePathRef mutablePath = CGPathCreateMutableCopy(_path); CGPathAddLineToPoint(mutablePath, NULL, point.x, point.y); self.CGPath = mutablePath; CGPathRelease(mutablePath); } - (void)addArcWithCenter:(CGPoint)center radius:(CGFloat)radius startAngle:(CGFloat)startAngle endAngle:(CGFloat)endAngle clockwise:(BOOL)clockwise { CGMutablePathRef mutablePath = CGPathCreateMutableCopy(_path); CGPathAddArc(mutablePath, NULL, center.x, center.y, radius, startAngle, endAngle, clockwise); self.CGPath = mutablePath; CGPathRelease(mutablePath); } - (void)addCurveToPoint:(CGPoint)endPoint controlPoint1:(CGPoint)controlPoint1 controlPoint2:(CGPoint)controlPoint2 { CGMutablePathRef mutablePath = CGPathCreateMutableCopy(_path); CGPathAddCurveToPoint(mutablePath, NULL, endPoint.x, endPoint.y, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y); self.CGPath = mutablePath; CGPathRelease(mutablePath); } - (void)addQuadCurveToPoint:(CGPoint)endPoint controlPoint:(CGPoint)controlPoint { CGMutablePathRef mutablePath = CGPathCreateMutableCopy(_path); CGPathAddQuadCurveToPoint(mutablePath, NULL, endPoint.x, endPoint.y, controlPoint.x, controlPoint.y); self.CGPath = mutablePath; CGPathRelease(mutablePath); } - (void)closePath { CGMutablePathRef mutablePath = CGPathCreateMutableCopy(_path); CGPathCloseSubpath(mutablePath); self.CGPath = mutablePath; CGPathRelease(mutablePath); } - (void)removeAllPoints { CGMutablePathRef mutablePath = CGPathCreateMutable(); self.CGPath = mutablePath; CGPathRelease(mutablePath); } - (void)appendPath:(UIBezierPath *)bezierPath { if (bezierPath) { CGMutablePathRef mutablePath = CGPathCreateMutableCopy(_path); CGPathAddPath(mutablePath, NULL, bezierPath.CGPath); self.CGPath = mutablePath; CGPathRelease(mutablePath); } } - (void)setCGPath:(CGPathRef)path { NSAssert(path != NULL, @"path must not be NULL"); if (path != _path) { if (_path) CGPathRelease(_path); _path = CGPathCreateCopy(path); } } - (CGPoint)currentPoint { return CGPathGetCurrentPoint(_path); } - (void)_setContextPath { CGContextRef context = UIGraphicsGetCurrentContext(); CGContextBeginPath(context); CGContextAddPath(context, _path); CGContextSetLineWidth(context, _lineWidth); CGContextSetLineCap(context, _lineCapStyle); CGContextSetLineJoin(context, _lineJoinStyle); CGContextSetMiterLimit(context, _miterLimit); CGContextSetFlatness(context, _flatness); CGContextSetLineDash(context, _lineDashPhase, &_lineDashPhase, _lineDashCount); } - (void)addClip { [self _setContextPath]; if (_usesEvenOddFillRule) { CGContextEOClip(UIGraphicsGetCurrentContext()); } else { CGContextClip(UIGraphicsGetCurrentContext()); } } - (void)setLineDash:(const CGFloat *)pattern count:(NSInteger)count phase:(CGFloat)phase { free(_lineDashPattern); if (pattern && count > 0) { const size_t size = sizeof(CGFloat)*count; _lineDashPattern = malloc(size); bcopy(pattern, _lineDashPattern, size); } else { _lineDashPattern = NULL; } _lineDashCount = count; _lineDashPhase = phase; } - (void)getLineDash:(CGFloat *)pattern count:(NSInteger *)count phase:(CGFloat *)phase { if (pattern && _lineDashPattern && _lineDashCount > 0) { const size_t size = sizeof(CGFloat)*_lineDashCount; bcopy(_lineDashPattern, pattern, size); } if (count) { *count = _lineDashCount; } if (phase) { *phase = _lineDashPhase; } } - (void)fill { CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSaveGState(context); [self _setContextPath]; if (_usesEvenOddFillRule) { CGContextEOFillPath(context); } else { CGContextFillPath(context); } CGContextBeginPath(context); CGContextRestoreGState(context); } - (void)fillWithBlendMode:(CGBlendMode)blendMode alpha:(CGFloat)alpha { CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSaveGState(context); CGContextSetAlpha(context, alpha); CGContextSetBlendMode(context, blendMode); [self fill]; CGContextRestoreGState(context); } - (void)stroke { CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSaveGState(context); [self _setContextPath]; CGContextStrokePath(context); CGContextBeginPath(context); CGContextRestoreGState(context); } - (void)strokeWithBlendMode:(CGBlendMode)blendMode alpha:(CGFloat)alpha { CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSaveGState(context); CGContextSetAlpha(context, alpha); CGContextSetBlendMode(context, blendMode); [self stroke]; CGContextRestoreGState(context); } - (BOOL)containsPoint:(CGPoint)point { return CGPathContainsPoint(_path, NULL, point, _usesEvenOddFillRule); } - (BOOL)isEmpty { return CGPathIsEmpty(_path); } - (CGRect)bounds { return CGPathGetBoundingBox(_path); } - (void)applyTransform:(CGAffineTransform)transform { CGMutablePathRef mutablePath = CGPathCreateMutable(); CGPathAddPath(mutablePath, &transform, _path); self.CGPath = mutablePath; CGPathRelease(mutablePath); } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIBulletGlyphGenerator.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @interface UIBulletGlyphGenerator : NSGlyphGenerator @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIBulletGlyphGenerator.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIBulletGlyphGenerator.h" #import @implementation UIBulletGlyphGenerator - (void)generateGlyphsForGlyphStorage:(id < NSGlyphStorage >)glyphStorage desiredNumberOfCharacters:(NSUInteger)nChars glyphIndex:(NSUInteger *)glyphIndex characterIndex:(NSUInteger *)charIndex { while (nChars > 0) { NSFont *font = [[glyphStorage attributedString] attribute:NSFontAttributeName atIndex:*charIndex effectiveRange:NULL]; NSGlyph g = [font glyphWithName:@"bullet"]; [glyphStorage insertGlyphs:&g length:1 forStartingGlyphAtIndex:*glyphIndex characterIndex:*charIndex]; (*charIndex)++; (*glyphIndex)++; nChars--; } } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIButton.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIControl.h" typedef enum { UIButtonTypeCustom = 0, UIButtonTypeRoundedRect, UIButtonTypeDetailDisclosure, UIButtonTypeInfoLight, UIButtonTypeInfoDark, UIButtonTypeContactAdd, } UIButtonType; @class UILabel, UIImageView, UIImage; @interface UIButton : UIControl { @protected UIButtonType _buttonType; @private UILabel *_titleLabel; UIImageView *_imageView; UIImageView *_backgroundImageView; BOOL _reversesTitleShadowWhenHighlighted; BOOL _adjustsImageWhenHighlighted; BOOL _adjustsImageWhenDisabled; BOOL _showsTouchWhenHighlighted; UIEdgeInsets _contentEdgeInsets; UIEdgeInsets _titleEdgeInsets; UIEdgeInsets _imageEdgeInsets; NSMutableDictionary *_content; UIImage *_adjustedHighlightImage; UIImage *_adjustedDisabledImage; } + (id)buttonWithType:(UIButtonType)buttonType; - (void)setTitle:(NSString *)title forState:(UIControlState)state; - (void)setTitleColor:(UIColor *)color forState:(UIControlState)state; - (void)setTitleShadowColor:(UIColor *)color forState:(UIControlState)state; - (void)setBackgroundImage:(UIImage *)image forState:(UIControlState)state; - (void)setImage:(UIImage *)image forState:(UIControlState)state; - (NSString *)titleForState:(UIControlState)state; - (UIColor *)titleColorForState:(UIControlState)state; - (UIColor *)titleShadowColorForState:(UIControlState)state; - (UIImage *)backgroundImageForState:(UIControlState)state; - (UIImage *)imageForState:(UIControlState)state; - (CGRect)backgroundRectForBounds:(CGRect)bounds; - (CGRect)contentRectForBounds:(CGRect)bounds; - (CGRect)titleRectForContentRect:(CGRect)contentRect; - (CGRect)imageRectForContentRect:(CGRect)contentRect; @property (nonatomic, readonly) UIButtonType buttonType; @property (nonatomic, readonly, strong) UILabel *titleLabel; @property (nonatomic, readonly, strong) UIImageView *imageView; @property (nonatomic) BOOL reversesTitleShadowWhenHighlighted; @property (nonatomic) BOOL adjustsImageWhenHighlighted; @property (nonatomic) BOOL adjustsImageWhenDisabled; @property (nonatomic) BOOL showsTouchWhenHighlighted; // no effect @property (nonatomic) UIEdgeInsets contentEdgeInsets; @property (nonatomic) UIEdgeInsets titleEdgeInsets; @property (nonatomic) UIEdgeInsets imageEdgeInsets; @property (nonatomic, readonly, strong) NSString *currentTitle; @property (nonatomic, readonly, strong) UIColor *currentTitleColor; @property (nonatomic, readonly, strong) UIColor *currentTitleShadowColor; @property (nonatomic, readonly, strong) UIImage *currentImage; @property (nonatomic, readonly, strong) UIImage *currentBackgroundImage; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIButton.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIButton.h" #import "UIControl+UIPrivate.h" #import "UILabel.h" #import "UIImage.h" #import "UIImageView+UIPrivate.h" #import "UIRoundedRectButton.h" #import "UIColor.h" static NSString *UIButtonContentTypeTitle = @"UIButtonContentTypeTitle"; static NSString *UIButtonContentTypeTitleColor = @"UIButtonContentTypeTitleColor"; static NSString *UIButtonContentTypeTitleShadowColor = @"UIButtonContentTypeTitleShadowColor"; static NSString *UIButtonContentTypeBackgroundImage = @"UIButtonContentTypeBackgroundImage"; static NSString *UIButtonContentTypeImage = @"UIButtonContentTypeImage"; @implementation UIButton @synthesize buttonType=_buttonType, titleLabel=_titleLabel, reversesTitleShadowWhenHighlighted=_reversesTitleShadowWhenHighlighted; @synthesize adjustsImageWhenHighlighted=_adjustsImageWhenHighlighted, adjustsImageWhenDisabled=_adjustsImageWhenDisabled; @synthesize showsTouchWhenHighlighted=_showsTouchWhenHighlighted, imageView=_imageView, contentEdgeInsets=_contentEdgeInsets; @synthesize titleEdgeInsets=_titleEdgeInsets, imageEdgeInsets=_imageEdgeInsets; + (id)buttonWithType:(UIButtonType)buttonType { switch (buttonType) { case UIButtonTypeRoundedRect: case UIButtonTypeDetailDisclosure: case UIButtonTypeInfoLight: case UIButtonTypeInfoDark: case UIButtonTypeContactAdd: return [[[UIRoundedRectButton alloc] init] autorelease]; case UIButtonTypeCustom: default: return [[[self alloc] init] autorelease]; } } - (id)initWithFrame:(CGRect)frame { if ((self=[super initWithFrame:frame])) { _buttonType = UIButtonTypeCustom; _content = [[NSMutableDictionary alloc] init]; _titleLabel = [[UILabel alloc] init]; _imageView = [[UIImageView alloc] init]; _backgroundImageView = [[UIImageView alloc] init]; _adjustsImageWhenHighlighted = YES; _adjustsImageWhenDisabled = YES; _showsTouchWhenHighlighted = NO; self.opaque = NO; _titleLabel.lineBreakMode = UILineBreakModeMiddleTruncation; _titleLabel.backgroundColor = [UIColor clearColor]; _titleLabel.textAlignment = UITextAlignmentLeft; _titleLabel.shadowOffset = CGSizeZero; [self addSubview:_backgroundImageView]; [self addSubview:_imageView]; [self addSubview:_titleLabel]; } return self; } - (void)dealloc { [_content release]; [_titleLabel release]; [_imageView release]; [_backgroundImageView release]; [_adjustedHighlightImage release]; [_adjustedDisabledImage release]; [super dealloc]; } - (NSString *)currentTitle { return _titleLabel.text; } - (UIColor *)currentTitleColor { return _titleLabel.textColor; } - (UIColor *)currentTitleShadowColor { return _titleLabel.shadowColor; } - (UIImage *)currentImage { return _imageView.image; } - (UIImage *)currentBackgroundImage { return _backgroundImageView.image; } - (UIColor *)_defaultTitleColor { return [UIColor whiteColor]; } - (UIColor *)_defaultTitleShadowColor { return [UIColor whiteColor]; } - (id)_contentForState:(UIControlState)state type:(NSString *)type { return [[_content objectForKey:type] objectForKey:[NSNumber numberWithInt:state]]; } - (id)_normalContentForState:(UIControlState)state type:(NSString *)type { return [self _contentForState:state type:type] ?: [self _contentForState:UIControlStateNormal type:type]; } - (void)_updateContent { const UIControlState state = self.state; _titleLabel.text = [self titleForState:state]; _titleLabel.textColor = [self titleColorForState:state] ?: [self _defaultTitleColor]; _titleLabel.shadowColor = [self titleShadowColorForState:state] ?: [self _defaultTitleShadowColor]; UIImage *image = [self _contentForState:state type:UIButtonContentTypeImage]; UIImage *backgroundImage = [self _contentForState:state type:UIButtonContentTypeBackgroundImage]; if (!image) { image = [self imageForState:state]; // find the correct default image to show if (_adjustsImageWhenDisabled && state & UIControlStateDisabled) { [_imageView _setDrawMode:_UIImageViewDrawModeDisabled]; } else if (_adjustsImageWhenHighlighted && state & UIControlStateHighlighted) { [_imageView _setDrawMode:_UIImageViewDrawModeHighlighted]; } else { [_imageView _setDrawMode:_UIImageViewDrawModeNormal]; } } else { [_imageView _setDrawMode:_UIImageViewDrawModeNormal]; } if (!backgroundImage) { backgroundImage = [self backgroundImageForState:state]; if (_adjustsImageWhenDisabled && state & UIControlStateDisabled) { [_backgroundImageView _setDrawMode:_UIImageViewDrawModeDisabled]; } else if (_adjustsImageWhenHighlighted && state & UIControlStateHighlighted) { [_backgroundImageView _setDrawMode:_UIImageViewDrawModeHighlighted]; } else { [_backgroundImageView _setDrawMode:_UIImageViewDrawModeNormal]; } } else { [_backgroundImageView _setDrawMode:_UIImageViewDrawModeNormal]; } _imageView.image = image; _backgroundImageView.image = backgroundImage; [self setNeedsLayout]; } - (void)_setContent:(id)value forState:(UIControlState)state type:(NSString *)type { NSMutableDictionary *typeContent = [_content objectForKey:type]; if (!typeContent) { typeContent = [[[NSMutableDictionary alloc] init] autorelease]; [_content setObject:typeContent forKey:type]; } NSNumber *key = [NSNumber numberWithInt:state]; if (value) { [typeContent setObject:value forKey:key]; } else { [typeContent removeObjectForKey:key]; } [self _updateContent]; } - (void)setTitle:(NSString *)title forState:(UIControlState)state { [self _setContent:title forState:state type:UIButtonContentTypeTitle]; } - (void)setTitleColor:(UIColor *)color forState:(UIControlState)state { [self _setContent:color forState:state type:UIButtonContentTypeTitleColor]; } - (void)setTitleShadowColor:(UIColor *)color forState:(UIControlState)state { [self _setContent:color forState:state type:UIButtonContentTypeTitleShadowColor]; } - (void)setBackgroundImage:(UIImage *)image forState:(UIControlState)state { [self _setContent:image forState:state type:UIButtonContentTypeBackgroundImage]; } - (void)setImage:(UIImage *)image forState:(UIControlState)state { [_adjustedHighlightImage release]; [_adjustedDisabledImage release]; _adjustedDisabledImage = _adjustedHighlightImage = nil; [self _setContent:image forState:state type:UIButtonContentTypeImage]; } - (NSString *)titleForState:(UIControlState)state { return [self _normalContentForState:state type:UIButtonContentTypeTitle]; } - (UIColor *)titleColorForState:(UIControlState)state { return [self _normalContentForState:state type:UIButtonContentTypeTitleColor]; } - (UIColor *)titleShadowColorForState:(UIControlState)state { return [self _normalContentForState:state type:UIButtonContentTypeTitleShadowColor]; } - (UIImage *)backgroundImageForState:(UIControlState)state { return [self _normalContentForState:state type:UIButtonContentTypeBackgroundImage]; } - (UIImage *)imageForState:(UIControlState)state { return [self _normalContentForState:state type:UIButtonContentTypeImage]; } - (CGRect)backgroundRectForBounds:(CGRect)bounds { return bounds; } - (CGRect)contentRectForBounds:(CGRect)bounds { return UIEdgeInsetsInsetRect(bounds,_contentEdgeInsets); } - (CGSize)_backgroundSizeForState:(UIControlState)state { UIImage *backgroundImage = [self backgroundImageForState:state]; return backgroundImage? backgroundImage.size : CGSizeZero; } - (CGSize)_titleSizeForState:(UIControlState)state { NSString *title = [self titleForState:state]; return ([title length] > 0)? [title sizeWithFont:_titleLabel.font constrainedToSize:CGSizeMake(CGFLOAT_MAX,CGFLOAT_MAX)] : CGSizeZero; } - (CGSize)_imageSizeForState:(UIControlState)state { UIImage *image = [self imageForState:state]; return image ? image.size : CGSizeZero; } - (CGRect)_componentRectForSize:(CGSize)size inContentRect:(CGRect)contentRect withState:(UIControlState)state { CGRect rect; rect.origin = contentRect.origin; rect.size = size; // clamp the right edge of the rect to the contentRect - this is what the real UIButton appears to do. if (CGRectGetMaxX(rect) > CGRectGetMaxX(contentRect)) { rect.size.width -= CGRectGetMaxX(rect) - CGRectGetMaxX(contentRect); } switch (self.contentHorizontalAlignment) { case UIControlContentHorizontalAlignmentCenter: rect.origin.x += floorf((contentRect.size.width/2.f) - (rect.size.width/2.f)); break; case UIControlContentHorizontalAlignmentRight: rect.origin.x += contentRect.size.width - rect.size.width; break; case UIControlContentHorizontalAlignmentFill: rect.size.width = contentRect.size.width; break; case UIControlContentHorizontalAlignmentLeft: // don't do anything - it's already left aligned break; } switch (self.contentVerticalAlignment) { case UIControlContentVerticalAlignmentCenter: rect.origin.y += floorf((contentRect.size.height/2.f) - (rect.size.height/2.f)); break; case UIControlContentVerticalAlignmentBottom: rect.origin.y += contentRect.size.height - rect.size.height; break; case UIControlContentVerticalAlignmentFill: rect.size.height = contentRect.size.height; break; case UIControlContentVerticalAlignmentTop: // don't do anything - it's already top aligned break; } return rect; } - (CGRect)titleRectForContentRect:(CGRect)contentRect { const UIControlState state = self.state; UIEdgeInsets inset = _titleEdgeInsets; inset.left += [self _imageSizeForState:state].width; return [self _componentRectForSize:[self _titleSizeForState:state] inContentRect:UIEdgeInsetsInsetRect(contentRect,inset) withState:state]; } - (CGRect)imageRectForContentRect:(CGRect)contentRect { const UIControlState state = self.state; UIEdgeInsets inset = _imageEdgeInsets; inset.right += [self titleRectForContentRect:contentRect].size.width; return [self _componentRectForSize:[self _imageSizeForState:state] inContentRect:UIEdgeInsetsInsetRect(contentRect,inset) withState:state]; } - (void)layoutSubviews { [super layoutSubviews]; const CGRect bounds = self.bounds; const CGRect contentRect = [self contentRectForBounds:bounds]; _backgroundImageView.frame = [self backgroundRectForBounds:bounds]; _titleLabel.frame = [self titleRectForContentRect:contentRect]; _imageView.frame = [self imageRectForContentRect:contentRect]; } - (void)_stateDidChange { [super _stateDidChange]; [self _updateContent]; } - (CGSize)sizeThatFits:(CGSize)size { const UIControlState state = self.state; const CGSize imageSize = [self _imageSizeForState:state]; const CGSize titleSize = [self _titleSizeForState:state]; CGSize fitSize; fitSize.width = _contentEdgeInsets.left + _contentEdgeInsets.right + titleSize.width + imageSize.width; fitSize.height = _contentEdgeInsets.top + _contentEdgeInsets.bottom + MAX(titleSize.height,imageSize.height); UIImage* background = [self currentBackgroundImage]; if(background) { CGSize backgroundSize = background.size; fitSize.width = MAX(fitSize.width, backgroundSize.width); fitSize.height = MAX(fitSize.height, backgroundSize.height); } return fitSize; } - (void)rightClick:(UITouch *)touch withEvent:(UIEvent *)event { // I'm swallowing right clicks on buttons by default, which is why this is here. // This isn't a strong decision, but there's a few places in Twitterrific where passing a right click through a button doesn't feel right. // It also doesn't feel immediately right to treat a right-click on a button as a normal click event, either, so this seems to be a // decent way to avoid the problem in general and define a kind of "standard" behavior in this case. } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIColor+UIPrivate.h ================================================ /* * Copyright (c) 2012, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIColor.h" @class UIColorRep; @interface UIColor (UIPrivate) - (id)_initWithRepresentations:(NSArray *)reps; - (UIColorRep *)_bestRepresentationForProposedScale:(CGFloat)scale; - (BOOL)_isOpaque; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIColor.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @class UIImage; @interface UIColor : NSObject { @private id _representations; } + (UIColor *)colorWithWhite:(CGFloat)white alpha:(CGFloat)alpha; + (UIColor *)colorWithHue:(CGFloat)hue saturation:(CGFloat)saturation brightness:(CGFloat)brightness alpha:(CGFloat)alpha; + (UIColor *)colorWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha; + (UIColor *)colorWithCGColor:(CGColorRef)ref; + (UIColor *)colorWithPatternImage:(UIImage *)patternImage; + (UIColor *)blackColor; + (UIColor *)darkGrayColor; + (UIColor *)lightGrayColor; + (UIColor *)whiteColor; + (UIColor *)grayColor; + (UIColor *)redColor; + (UIColor *)greenColor; + (UIColor *)blueColor; + (UIColor *)cyanColor; + (UIColor *)yellowColor; + (UIColor *)magentaColor; + (UIColor *)orangeColor; + (UIColor *)purpleColor; + (UIColor *)brownColor; + (UIColor *)clearColor; - (id)initWithWhite:(CGFloat)white alpha:(CGFloat)alpha; - (id)initWithHue:(CGFloat)hue saturation:(CGFloat)saturation brightness:(CGFloat)brightness alpha:(CGFloat)alpha; - (id)initWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha; - (id)initWithCGColor:(CGColorRef)ref; - (id)initWithPatternImage:(UIImage *)patternImage; - (UIColor *)colorWithAlphaComponent:(CGFloat)alpha; - (void)set; - (void)setFill; - (void)setStroke; @property (nonatomic, readonly) CGColorRef CGColor; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIColor.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIColor+UIPrivate.h" #import "UIColorRep.h" #import "UIImage+UIPrivate.h" #import "UIGraphics.h" #import #import static UIColor *BlackColor = nil; static UIColor *DarkGrayColor = nil; static UIColor *LightGrayColor = nil; static UIColor *WhiteColor = nil; static UIColor *GrayColor = nil; static UIColor *RedColor = nil; static UIColor *GreenColor = nil; static UIColor *BlueColor = nil; static UIColor *CyanColor = nil; static UIColor *YellowColor = nil; static UIColor *MagentaColor = nil; static UIColor *OrangeColor = nil; static UIColor *PurpleColor = nil; static UIColor *BrownColor = nil; static UIColor *ClearColor = nil; @implementation UIColor - (id)initWithNSColor:(NSColor *)aColor { if (!aColor) { [self release]; self = nil; } else { NSColor *c = [aColor colorUsingColorSpace:[NSColorSpace deviceRGBColorSpace]]; CGFloat components[[c numberOfComponents]]; [c getComponents:components]; CGColorRef color = CGColorCreate([[c colorSpace] CGColorSpace], components); self = [self initWithCGColor:color]; CGColorRelease(color); } return self; } - (void)dealloc { [_representations release]; [super dealloc]; } + (id)colorWithNSColor:(NSColor *)c { return [[[self alloc] initWithNSColor:c] autorelease]; } + (UIColor *)colorWithWhite:(CGFloat)white alpha:(CGFloat)alpha { return [[[self alloc] initWithWhite:white alpha:alpha] autorelease]; } + (UIColor *)colorWithHue:(CGFloat)hue saturation:(CGFloat)saturation brightness:(CGFloat)brightness alpha:(CGFloat)alpha { return [[[self alloc] initWithHue:hue saturation:saturation brightness:brightness alpha:alpha] autorelease]; } + (UIColor *)colorWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha { return [[[self alloc] initWithRed:red green:green blue:blue alpha:alpha] autorelease]; } + (UIColor *)colorWithCGColor:(CGColorRef)ref { return [[[self alloc] initWithCGColor:ref] autorelease]; } + (UIColor *)colorWithPatternImage:(UIImage *)patternImage { return [[[self alloc] initWithPatternImage:patternImage] autorelease]; } + (UIColor *)blackColor { return BlackColor ?: (BlackColor = [[self alloc] initWithNSColor:[NSColor blackColor]]); } + (UIColor *)darkGrayColor { return DarkGrayColor ?: (DarkGrayColor = [[self alloc] initWithNSColor:[NSColor darkGrayColor]]); } + (UIColor *)lightGrayColor { return LightGrayColor ?: (LightGrayColor = [[self alloc] initWithNSColor:[NSColor lightGrayColor]]); } + (UIColor *)whiteColor { return WhiteColor ?: (WhiteColor = [[self alloc] initWithNSColor:[NSColor whiteColor]]); } + (UIColor *)grayColor { return GrayColor ?: (GrayColor = [[self alloc] initWithNSColor:[NSColor grayColor]]); } + (UIColor *)redColor { return RedColor ?: (RedColor = [[self alloc] initWithNSColor:[NSColor redColor]]); } + (UIColor *)greenColor { return GreenColor ?: (GreenColor = [[self alloc] initWithNSColor:[NSColor greenColor]]); } + (UIColor *)blueColor { return BlueColor ?: (BlueColor = [[self alloc] initWithNSColor:[NSColor blueColor]]); } + (UIColor *)cyanColor { return CyanColor ?: (CyanColor = [[self alloc] initWithNSColor:[NSColor cyanColor]]); } + (UIColor *)yellowColor { return YellowColor ?: (YellowColor = [[self alloc] initWithNSColor:[NSColor yellowColor]]); } + (UIColor *)magentaColor { return MagentaColor ?: (MagentaColor = [[self alloc] initWithNSColor:[NSColor magentaColor]]); } + (UIColor *)orangeColor { return OrangeColor ?: (OrangeColor = [[self alloc] initWithNSColor:[NSColor orangeColor]]); } + (UIColor *)purpleColor { return PurpleColor ?: (PurpleColor = [[self alloc] initWithNSColor:[NSColor purpleColor]]); } + (UIColor *)brownColor { return BrownColor ?: (BrownColor = [[self alloc] initWithNSColor:[NSColor brownColor]]); } + (UIColor *)clearColor { return ClearColor ?: (ClearColor = [[self alloc] initWithNSColor:[NSColor clearColor]]); } - (id)initWithWhite:(CGFloat)white alpha:(CGFloat)alpha { return [self initWithNSColor:[NSColor colorWithDeviceWhite:white alpha:alpha]]; } - (id)initWithHue:(CGFloat)hue saturation:(CGFloat)saturation brightness:(CGFloat)brightness alpha:(CGFloat)alpha { return [self initWithNSColor:[NSColor colorWithDeviceHue:hue saturation:saturation brightness:brightness alpha:alpha]]; } - (id)initWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha { return [self initWithNSColor:[NSColor colorWithDeviceRed:red green:green blue:blue alpha:alpha]]; } - (id)_initWithRepresentations:(NSArray *)reps { if ([reps count] == 0) { [self release]; self = nil; } else if ((self=[super init])) { _representations = [reps copy]; } return self; } - (id)initWithCGColor:(CGColorRef)ref { return [self _initWithRepresentations:[NSArray arrayWithObjects:[[[UIColorRep alloc] initWithCGColor:ref] autorelease], nil]]; } - (id)initWithPatternImage:(UIImage *)patternImage { NSArray *imageReps = [patternImage _representations]; NSMutableArray *colorReps = [NSMutableArray arrayWithCapacity:[imageReps count]]; for (UIImageRep *imageRep in imageReps) { [colorReps addObject:[[[UIColorRep alloc] initWithPatternImageRepresentation:imageRep] autorelease]]; } return [self _initWithRepresentations:colorReps]; } - (UIColorRep *)_bestRepresentationForProposedScale:(CGFloat)scale { UIColorRep *bestRep = nil; for (UIColorRep *rep in _representations) { if (rep.scale > scale) { break; } else { bestRep = rep; } } return bestRep ?: [_representations lastObject]; } - (BOOL)_isOpaque { for (UIColorRep *rep in _representations) { if (!rep.opaque) { return NO; } } return YES; } - (void)set { [self setFill]; [self setStroke]; } - (void)setFill { CGContextRef ctx = UIGraphicsGetCurrentContext(); CGContextSetFillColorWithColor(ctx, [self _bestRepresentationForProposedScale:_UIGraphicsGetContextScaleFactor(ctx)].CGColor); } - (void)setStroke { CGContextRef ctx = UIGraphicsGetCurrentContext(); CGContextSetStrokeColorWithColor(ctx, [self _bestRepresentationForProposedScale:_UIGraphicsGetContextScaleFactor(ctx)].CGColor); } - (CGColorRef)CGColor { return [self _bestRepresentationForProposedScale:1].CGColor; } - (UIColor *)colorWithAlphaComponent:(CGFloat)alpha { CGColorRef newColor = CGColorCreateCopyWithAlpha(self.CGColor, alpha); UIColor *resultingUIColor = [UIColor colorWithCGColor:newColor]; CGColorRelease(newColor); return resultingUIColor; } - (NSColor *)NSColor { CGColorRef color = self.CGColor; NSColorSpace *colorSpace = [[NSColorSpace alloc] initWithCGColorSpace:CGColorGetColorSpace(color)]; const NSInteger numberOfComponents = CGColorGetNumberOfComponents(color); const CGFloat *components = CGColorGetComponents(color); NSColor *theColor = [NSColor colorWithColorSpace:colorSpace components:components count:numberOfComponents]; [colorSpace release]; return theColor; } - (NSString *)description { // The color space string this gets isn't exactly the same as Apple's implementation. // For instance, Apple's implementation returns UIDeviceRGBColorSpace for [UIColor redColor] // This implementation returns kCGColorSpaceDeviceRGB instead. // Apple doesn't actually define UIDeviceRGBColorSpace or any of the other responses anywhere public, // so there isn't any easy way to emulate it. CGColorSpaceRef colorSpaceRef = CGColorGetColorSpace(self.CGColor); NSString *colorSpace = [NSString stringWithFormat:@"%@", [(NSString *)CGColorSpaceCopyName(colorSpaceRef) autorelease]]; const size_t numberOfComponents = CGColorGetNumberOfComponents(self.CGColor); const CGFloat *components = CGColorGetComponents(self.CGColor); NSMutableString *componentsString = [NSMutableString stringWithString:@"{"]; for (NSInteger index = 0; index < numberOfComponents; index++) { if (index) [componentsString appendString:@", "]; [componentsString appendFormat:@"%.0f", components[index]]; } [componentsString appendString:@"}"]; return [NSString stringWithFormat:@"<%@: %p; colorSpace = %@; components = %@>", [self className], self, colorSpace, componentsString]; } - (BOOL) isEqual:(id)object { if (![object isKindOfClass:[self class]]) { return NO; } UIColor* color = (UIColor*) object; return CGColorEqualToColor(self.CGColor, color.CGColor); } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIColorAppKitIntegration.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIColor.h" @class NSColor; @interface UIColor (AppKitIntegration) + (id)colorWithNSColor:(NSColor *)c; - (id)initWithNSColor:(NSColor *)c; - (NSColor *)NSColor; // NOTE: At present, if the UIColor was created with an image, this is unlikely to work. @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIColorRep.h ================================================ /* * Copyright (c) 2012, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @class UIImageRep; @interface UIColorRep : NSObject { CGColorRef _CGColor; UIImageRep *_patternImageRep; } - (id)initWithPatternImageRepresentation:(UIImageRep *)patternImageRep; - (id)initWithCGColor:(CGColorRef)color; @property (nonatomic, readonly) CGColorRef CGColor; @property (nonatomic, readonly) CGFloat scale; @property (nonatomic, readonly) UIImageRep *patternImageRep; @property (nonatomic, readonly, getter=isOpaque) BOOL opaque; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIColorRep.m ================================================ /* * Copyright (c) 2012, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIColorRep.h" #import "UIImageRep.h" #import "UIGraphics.h" #import #import static void drawPatternImage(void *info, CGContextRef ctx) { UIImageRep *rep = [(__bridge UIColorRep *)info patternImageRep]; UIGraphicsPushContext(ctx); CGContextSaveGState(ctx); const CGRect patternRect = {CGPointZero, rep.imageSize}; const CGRect deviceRect = CGContextConvertRectToDeviceSpace(ctx, patternRect); // this attempts to detect a flipped context and then counter-flips it. // I don't like this because it seems like it shouldn't be necessary and that I'm missing something more fundamental. // If a pattern color is used as a backgroundColor on a UIView with no drawRect:, it will set the backgrounColor of // the view's layer directly with the CGColor (which is made from this pattern image). In that case, the pattern // appears flipped for reasons I don't fully understand unless I apply this counter-flip transform. If the UIView does // have a drawRect:, then the different way that the background color is set (UIView draws it directly into the // CGContext that Core Animation gives it before calling drawRect:), causes the pattern to appear right-side-up. if (floorf(NSAppKitVersionNumber) != NSAppKitVersionNumber10_7) { if (CGPointEqualToPoint(patternRect.origin, deviceRect.origin)) { CGContextTranslateCTM(ctx, 0, patternRect.size.height); CGContextScaleCTM(ctx, 1, -1); } } [rep drawInRect:patternRect fromRect:CGRectNull]; CGContextRestoreGState(ctx); UIGraphicsPopContext(); } @implementation UIColorRep @synthesize patternImageRep = _patternImageRep; - (id)initWithPatternImageRepresentation:(UIImageRep *)patternImageRep { if (!patternImageRep) { [self release]; self = nil; } else if ((self=[super init])) { _patternImageRep = [patternImageRep retain]; } return self; } - (id)initWithCGColor:(CGColorRef)color { if (!color) { [self release]; self = nil; } else if ((self=[super init])) { _CGColor = CGColorRetain(color); } return self; } - (void)dealloc { [_patternImageRep release]; CGColorRelease(_CGColor); [super dealloc]; } - (CGColorRef)CGColor { if (!_CGColor && _patternImageRep) { const CGSize imageSize = _patternImageRep.imageSize; const CGFloat scaler = 1/_patternImageRep.scale; //const CGAffineTransform t = CGAffineTransformScale(CGAffineTransformMake(1, 0, 0, -1, 0, imageSize.height), scaler, scaler); const CGAffineTransform t = CGAffineTransformMakeScale(scaler, scaler); static const CGPatternCallbacks callbacks = {0, &drawPatternImage, NULL}; CGPatternRef pattern = CGPatternCreate ((void *)self, CGRectMake (0, 0, imageSize.width, imageSize.height), t, imageSize.width, imageSize.height, kCGPatternTilingConstantSpacing, true, &callbacks); CGColorSpaceRef space = CGColorSpaceCreatePattern(NULL); CGFloat components[1] = {1.0}; _CGColor = CGColorCreateWithPattern(space, pattern, components); CGColorSpaceRelease(space); CGPatternRelease(pattern); } return _CGColor; } - (CGFloat)scale { return _patternImageRep? _patternImageRep.scale : 1; } - (BOOL)isOpaque { if (!_patternImageRep && _CGColor) { return CGColorGetAlpha(_CGColor) == 1; } else { return _patternImageRep.opaque; } } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIControl+UIPrivate.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIControl.h" @interface UIControl (UIPrivate) - (void)_stateDidChange; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIControl.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIView.h" enum { UIControlEventTouchDown = 1 << 0, UIControlEventTouchDownRepeat = 1 << 1, UIControlEventTouchDragInside = 1 << 2, UIControlEventTouchDragOutside = 1 << 3, UIControlEventTouchDragEnter = 1 << 4, UIControlEventTouchDragExit = 1 << 5, UIControlEventTouchUpInside = 1 << 6, UIControlEventTouchUpOutside = 1 << 7, UIControlEventTouchCancel = 1 << 8, UIControlEventValueChanged = 1 << 12, UIControlEventEditingDidBegin = 1 << 16, UIControlEventEditingChanged = 1 << 17, UIControlEventEditingDidEnd = 1 << 18, UIControlEventEditingDidEndOnExit = 1 << 19, UIControlEventAllTouchEvents = 0x00000FFF, UIControlEventAllEditingEvents = 0x000F0000, UIControlEventApplicationReserved = 0x0F000000, UIControlEventSystemReserved = 0xF0000000, UIControlEventAllEvents = 0xFFFFFFFF }; typedef NSUInteger UIControlEvents; enum { UIControlStateNormal = 0, UIControlStateHighlighted = 1 << 0, UIControlStateDisabled = 1 << 1, UIControlStateSelected = 1 << 2, UIControlStateApplication = 0x00FF0000, UIControlStateReserved = 0xFF000000 }; typedef NSUInteger UIControlState; typedef enum { UIControlContentHorizontalAlignmentCenter = 0, UIControlContentHorizontalAlignmentLeft = 1, UIControlContentHorizontalAlignmentRight = 2, UIControlContentHorizontalAlignmentFill = 3, } UIControlContentHorizontalAlignment; typedef enum { UIControlContentVerticalAlignmentCenter = 0, UIControlContentVerticalAlignmentTop = 1, UIControlContentVerticalAlignmentBottom = 2, UIControlContentVerticalAlignmentFill = 3, } UIControlContentVerticalAlignment; @interface UIControl : UIView { @protected NSMutableArray *_registeredActions; BOOL _tracking; BOOL _touchInside; BOOL _enabled; BOOL _selected; BOOL _highlighted; UIControlContentHorizontalAlignment _contentHorizontalAlignment; UIControlContentVerticalAlignment _contentVerticalAlignment; } - (void)addTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents; - (void)removeTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents; - (NSArray *)actionsForTarget:(id)target forControlEvent:(UIControlEvents)controlEvent; - (NSSet *)allTargets; - (UIControlEvents)allControlEvents; - (void)sendActionsForControlEvents:(UIControlEvents)controlEvents; - (void)sendAction:(SEL)action to:(id)target forEvent:(UIEvent *)event; - (BOOL)beginTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event; - (BOOL)continueTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event; - (void)endTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event; - (void)cancelTrackingWithEvent:(UIEvent *)event; @property (nonatomic, readonly) UIControlState state; @property (nonatomic, getter=isEnabled) BOOL enabled; @property (nonatomic, getter=isSelected) BOOL selected; @property (nonatomic, getter=isHighlighted) BOOL highlighted; @property (nonatomic, readonly, getter=isTracking) BOOL tracking; @property (nonatomic, readonly, getter=isTouchInside) BOOL touchInside; @property (nonatomic) UIControlContentHorizontalAlignment contentHorizontalAlignment; @property (nonatomic) UIControlContentVerticalAlignment contentVerticalAlignment; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIControl.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIControl+UIPrivate.h" #import "UIEvent.h" #import "UITouch.h" #import "UIApplication.h" #import "UIControlAction.h" @implementation UIControl @synthesize tracking=_tracking, touchInside=_touchInside, selected=_selected, enabled=_enabled, highlighted=_highlighted; @synthesize contentHorizontalAlignment=_contentHorizontalAlignment, contentVerticalAlignment=_contentVerticalAlignment; - (id)initWithFrame:(CGRect)frame { if ((self=[super initWithFrame:frame])) { _registeredActions = [[NSMutableArray alloc] init]; self.enabled = YES; self.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter; self.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; } return self; } - (void)dealloc { [_registeredActions release]; [super dealloc]; } - (void)addTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents { UIControlAction *controlAction = [[UIControlAction alloc] init]; controlAction.target = target; controlAction.action = action; controlAction.controlEvents = controlEvents; [_registeredActions addObject:controlAction]; [controlAction release]; } - (void)removeTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents { NSMutableArray *discard = [[NSMutableArray alloc] init]; for (UIControlAction *controlAction in _registeredActions) { if (controlAction.target == target && (action == NULL || controlAction.controlEvents == controlEvents)) { [discard addObject:controlAction]; } } [_registeredActions removeObjectsInArray:discard]; [discard release]; } - (NSArray *)actionsForTarget:(id)target forControlEvent:(UIControlEvents)controlEvent { NSMutableArray *actions = [[NSMutableArray alloc] init]; for (UIControlAction *controlAction in _registeredActions) { if ((target == nil || controlAction.target == target) && (controlAction.controlEvents & controlEvent) ) { [actions addObject:NSStringFromSelector(controlAction.action)]; } } if ([actions count] == 0) { [actions release]; return nil; } else { return [actions autorelease]; } } - (NSSet *)allTargets { return [NSSet setWithArray:[_registeredActions valueForKey:@"target"]]; } - (UIControlEvents)allControlEvents { UIControlEvents allEvents = 0; for (UIControlAction *controlAction in _registeredActions) { allEvents |= controlAction.controlEvents; } return allEvents; } - (void)_sendActionsForControlEvents:(UIControlEvents)controlEvents withEvent:(UIEvent *)event { for (UIControlAction *controlAction in _registeredActions) { if (controlAction.controlEvents & controlEvents) { [self sendAction:controlAction.action to:controlAction.target forEvent:event]; } } } - (void)sendActionsForControlEvents:(UIControlEvents)controlEvents { [self _sendActionsForControlEvents:controlEvents withEvent:nil]; } - (void)sendAction:(SEL)action to:(id)target forEvent:(UIEvent *)event { [[UIApplication sharedApplication] sendAction:action to:target from:self forEvent:event]; } - (BOOL)beginTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event { return YES; } - (BOOL)continueTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event { return YES; } - (void)endTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event { } - (void)cancelTrackingWithEvent:(UIEvent *)event { } - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; _touchInside = YES; _tracking = [self beginTrackingWithTouch:touch withEvent:event]; self.highlighted = YES; if (_tracking) { UIControlEvents currentEvents = UIControlEventTouchDown; if (touch.tapCount > 1) { currentEvents |= UIControlEventTouchDownRepeat; } [self _sendActionsForControlEvents:currentEvents withEvent:event]; } } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; const BOOL wasTouchInside = _touchInside; _touchInside = [self pointInside:[touch locationInView:self] withEvent:event]; self.highlighted = _touchInside; if (_tracking) { _tracking = [self continueTrackingWithTouch:touch withEvent:event]; if (_tracking) { UIControlEvents currentEvents = ((_touchInside)? UIControlEventTouchDragInside : UIControlEventTouchDragOutside); if (!wasTouchInside && _touchInside) { currentEvents |= UIControlEventTouchDragEnter; } else if (wasTouchInside && !_touchInside) { currentEvents |= UIControlEventTouchDragExit; } [self _sendActionsForControlEvents:currentEvents withEvent:event]; } } } - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; _touchInside = [self pointInside:[touch locationInView:self] withEvent:event]; self.highlighted = NO; if (_tracking) { [self endTrackingWithTouch:touch withEvent:event]; [self _sendActionsForControlEvents:((_touchInside)? UIControlEventTouchUpInside : UIControlEventTouchUpOutside) withEvent:event]; } _tracking = NO; _touchInside = NO; } - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { self.highlighted = NO; if (_tracking) { [self cancelTrackingWithEvent:event]; [self _sendActionsForControlEvents:UIControlEventTouchCancel withEvent:event]; } _touchInside = NO; _tracking = NO; } - (void)_stateDidChange { [self setNeedsDisplay]; [self setNeedsLayout]; } - (void)setEnabled:(BOOL)newEnabled { if (newEnabled != _enabled) { _enabled = newEnabled; [self _stateDidChange]; self.userInteractionEnabled = _enabled; } } - (void)setHighlighted:(BOOL)newHighlighted { if (newHighlighted != _highlighted) { _highlighted = newHighlighted; [self _stateDidChange]; } } - (void)setSelected:(BOOL)newSelected { if (newSelected != _selected) { _selected = newSelected; [self _stateDidChange]; } } - (UIControlState)state { UIControlState state = UIControlStateNormal; if (_highlighted) state |= UIControlStateHighlighted; if (!_enabled) state |= UIControlStateDisabled; if (_selected) state |= UIControlStateSelected; return state; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIControlAction.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIAction.h" #import "UIControl.h" @interface UIControlAction : UIAction { UIControlEvents _controlEvents; } @property (nonatomic, assign) UIControlEvents controlEvents; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIControlAction.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIControlAction.h" @implementation UIControlAction @synthesize controlEvents=_controlEvents; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UICustomNSClipView.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @class CALayer; @protocol UICustomNSClipViewBehaviorDelegate // the point should be in the clip view's superview coordinate space - aka the "screen" coordinate space because if everything // is being done correctly, this view is never nested inside any other kind of NSView. - (BOOL)hitTestForClipViewPoint:(NSPoint)point; // return NO if scroll wheel events should be ignored, otherwise return YES - (BOOL)clipViewShouldScroll; @end @interface UICustomNSClipView : NSClipView { CALayer *parentLayer; id behaviorDelegate; } - (id)initWithFrame:(NSRect)frame; // A layer parent is just a layer that UICustonNSClipView will attempt to always remain a sublayer of. // Circumventing AppKit for fun and profit! // The hitDelegate is for faking out the NSView's usual hitTest: checks to handle cases where UIViews are above // the UIView that's displaying this layer. @property (nonatomic, assign) CALayer *parentLayer; @property (nonatomic, assign) id behaviorDelegate; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UICustomNSClipView.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UICustomNSClipView.h" #import #import #import @implementation UICustomNSClipView @synthesize parentLayer, behaviorDelegate; - (id)initWithFrame:(NSRect)frame { if ((self=[super initWithFrame:frame])) { [self setDrawsBackground:NO]; [self setWantsLayer:YES]; } return self; } - (void)scrollWheel:(NSEvent *)event { if ([behaviorDelegate clipViewShouldScroll]) { NSPoint offset = [self bounds].origin; offset.x += [event deltaX]; offset.y -= [event deltaY]; offset.x = floor(offset.x); offset.y = floor(offset.y); [self scrollToPoint:[self constrainScrollPoint:offset]]; } else { [[self nextResponder] scrollWheel:event]; } } - (void)fixupTheLayer { if ([self superview] && parentLayer) { [CATransaction begin]; [CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions]; CALayer *layer = [self layer]; if (parentLayer != layer.superlayer) { [parentLayer addSublayer:layer]; } if (!CGRectEqualToRect(layer.frame, parentLayer.bounds)) { layer.frame = parentLayer.bounds; } [CATransaction commit]; } } - (void)viewDidMoveToSuperview { [super viewDidMoveToSuperview]; [self fixupTheLayer]; } - (void)viewWillDraw { [super viewWillDraw]; [self fixupTheLayer]; } - (void)setFrame:(NSRect)frame { [super setFrame:frame]; [self fixupTheLayer]; } - (void)viewDidUnhide { [super viewDidUnhide]; [self fixupTheLayer]; } - (NSView *)hitTest:(NSPoint)aPoint { NSView *hit = [super hitTest:aPoint]; if (hit && behaviorDelegate) { // call out to the text layer via a delegate or something and ask if this point should be considered a hit or not. // if not, then we set hit to nil, otherwise we return it like normal. // the purpose of this is to make the NSView act invisible/hidden to clicks when it's visually behind other UIViews. // super tricky, eh? if (![behaviorDelegate hitTestForClipViewPoint:aPoint]) { hit = nil; } } return hit; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UICustomNSTextView.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @class CALayer, UICustomNSTextView; @protocol UICustomNSTextViewDelegate - (BOOL)textViewBecomeFirstResponder:(UICustomNSTextView *)textView; - (BOOL)textViewResignFirstResponder:(UICustomNSTextView *)textView; - (BOOL)textView:(UICustomNSTextView *)textView shouldAcceptKeyDown:(NSEvent *)event; @end @interface UICustomNSTextView: NSTextView { BOOL secureTextEntry; BOOL isBecomingFirstResponder; } - (id)initWithFrame:(NSRect)frame secureTextEntry:(BOOL)isSecure isField:(BOOL)isField; - (void)setSecureTextEntry:(BOOL)isSecure; - (BOOL)reallyBecomeFirstResponder; - (BOOL)reallyResignFirstResponder; - (id)delegate; - (void)setDelegate:(id)d; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UICustomNSTextView.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UICustomNSTextView.h" #import "UIBulletGlyphGenerator.h" #import #import #import #import #import #import #import static const CGFloat LargeNumberForText = 1.0e7; // Any larger dimensions and the text could become blurry. @interface UICustomNSTextView () @end @implementation UICustomNSTextView - (id)initWithFrame:(NSRect)frame secureTextEntry:(BOOL)isSecure isField:(BOOL)isField { if ((self=[super initWithFrame:frame])) { const NSSize maxSize = NSMakeSize(LargeNumberForText, LargeNumberForText); // this is not ideal, I suspect... but it seems to work for now. // one behavior that's missing is that when a field resigns first responder, // it should really sort of turn back into a non-field that happens to have no word wrapping. // right now I have it scroll to the beginning of the line, at least, but even though the line break // mode is set to truncate on the tail, it doesn't do that because the underlying text container's size // has been sized to something bigger here. I tried to work around this by resetting the modes and such // on resignFirstResponder, but for some reason it just didn't seem to work reliably (especially when // the view was resized - it's like once you turn off setWidthTracksTextView, it doesn't want to turn // back on again). I'm likely missing something important, but it's not crazy important right now. if (isField) { [self setFieldEditor:YES]; [self setHorizontallyResizable:YES]; [self setVerticallyResizable:NO]; [[self textContainer] setWidthTracksTextView:NO]; [[self textContainer] setContainerSize:maxSize]; } else { [self setFieldEditor:NO]; [self setHorizontallyResizable:NO]; [self setVerticallyResizable:YES]; [self setAutoresizingMask:NSViewWidthSizable]; } [self setMaxSize:maxSize]; [self setDrawsBackground:NO]; [self setRichText:NO]; [self setUsesFontPanel:NO]; [self setImportsGraphics:NO]; [self setAllowsImageEditing:NO]; [self setDisplaysLinkToolTips:NO]; [self setAutomaticDataDetectionEnabled:NO]; [self setSecureTextEntry:isSecure]; [self setLayerContentsPlacement:NSViewLayerContentsPlacementTopLeft]; // this is for a spell checking hack.. see below [[self layoutManager] setDelegate:self]; } return self; } - (void)updateStyles { NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init]; [style setParagraphStyle:[NSParagraphStyle defaultParagraphStyle]]; if (secureTextEntry) { // being all super-paranoid here... [self setAutomaticQuoteSubstitutionEnabled:NO]; [self setGrammarCheckingEnabled:NO]; [self setAutomaticSpellingCorrectionEnabled:NO]; [self setContinuousSpellCheckingEnabled:NO]; [self setAutomaticDashSubstitutionEnabled:NO]; [self setAutomaticTextReplacementEnabled:NO]; [self setSmartInsertDeleteEnabled:NO]; [self setUsesFindPanel:NO]; [self setAllowsUndo:NO]; [[self layoutManager] setGlyphGenerator:[[[UIBulletGlyphGenerator alloc] init] autorelease]]; [style setLineBreakMode:NSLineBreakByCharWrapping]; } else { [self setAllowsUndo:YES]; [self setContinuousSpellCheckingEnabled:YES]; [self setSmartInsertDeleteEnabled:YES]; [self setUsesFindPanel:YES]; [[self layoutManager] setGlyphGenerator:[NSGlyphGenerator sharedGlyphGenerator]]; } if ([self isFieldEditor]) { [style setLineBreakMode:NSLineBreakByTruncatingTail]; } [self setDefaultParagraphStyle:style]; [style release]; } - (void)setSecureTextEntry:(BOOL)isSecure { secureTextEntry = isSecure; [self updateStyles]; } - (BOOL)validateMenuItem:(NSMenuItem *)menuItem { if (secureTextEntry && ([menuItem action] == @selector(copy:) || [menuItem action] == @selector(cut:))) { return NO; // don't allow copying/cutting out from a secure field } else { return [super validateMenuItem:menuItem]; } } - (NSSelectionGranularity)selectionGranularity { if (secureTextEntry) { return NSSelectByCharacter; // trying to avoid the secure one giving any hints about what's under it. :/ } else { return [super selectionGranularity]; } } - (void)startSpeaking:(id)sender { // only allow speaking if it's not secure if (!secureTextEntry) { [super startSpeaking:sender]; } } - (id)validRequestorForSendType:(NSString *)sendType returnType:(NSString *)returnType { if (secureTextEntry) { return nil; } else { return [super validRequestorForSendType:sendType returnType:returnType]; } } - (NSMenu *)menuForEvent:(NSEvent *)theEvent { NSMenu *menu = [super menuForEvent:theEvent]; // screw it.. why not just remove everything from the context menu if it's a secure field? :) // it's possible that various key combos could still allow things like searching in spotlight which // then would revel the actual value of the password field, but at least those are sorta obscure :) if (secureTextEntry) { NSArray *items = [[[menu itemArray] copy] autorelease]; for (NSMenuItem *item in items) { if ([item action] != @selector(paste:)) { [menu removeItem:item]; } } } return menu; } - (id)delegate { return (id)[super delegate]; } - (void)setDelegate:(id)d { [super setDelegate:d]; } - (BOOL)becomeFirstResponder { isBecomingFirstResponder = YES; BOOL result = [[self delegate] textViewBecomeFirstResponder:self]; isBecomingFirstResponder = NO; return result; } - (BOOL)reallyBecomeFirstResponder { return [super becomeFirstResponder]; } - (BOOL)resignFirstResponder { if(isBecomingFirstResponder) return NO; return [[self delegate] textViewResignFirstResponder:self]; } - (BOOL)reallyResignFirstResponder { if ([self isFieldEditor]) { [self scrollRangeToVisible:NSMakeRange(0,0)]; } [self setSelectedRange:NSMakeRange(0,0)]; return [super resignFirstResponder]; } - (void)keyDown:(NSEvent *)event { if ([[self delegate] textView:self shouldAcceptKeyDown:event]) { [super keyDown:event]; } } #pragma mark - #pragma mark Spell Checking Hacks Of Doom // These horrible spell checking hacks are here because when in a layer, NSTextView appears to refuse to properly support spell checking. // It seems that, as of now (10.6.5) there's a variety of problems. // // 1) It doesn't even try to draw the red underlines when a word is misspelled. // 2) When typing, it doesn't appear to correctly update the misspelled state even if it *did* draw the lines correctly. // // I worked around #1 by just implementing my own drawing routine and telling the NSLayoutManager not to draw temp attributes itself just in // case Apple were to fix some of this in 10.7. (Otherwise I suspect we'd end up with multiple underlines that don't quite match, etc.) // // As for #2... // // It seems that when in a layer (or as some side effect of how I'm manipulating things here to hack this into UIKit), NSTextView will set the // range of the word the cursor is touching/within to be spelled correctly even if it isn't. (It's always setting the spelling state to 0 no // matter what I do). This results in words never being marked as misspelled, therefore even my hack to draw the underline fails. To work // around this, I'm detecting when the text and/or the cursor's position have changed and setting a timer for a short time. When the timer // expires, I'm forcing a check of the entire text of the NSTextView. This seemingly results in updating the spelling state correctly for all // but the word that the cursor might happen to be in. This appears to be about the best I can come up with given the documentation and // unwillingness to resort to private APIs. It's not right, though, and you can feel it when using the text view. There's weird lags and // timings when it decides to do a spell check. It's also not very effecient to be rechecking the entire text view, but I'm hoping some other // approach and/or a fix from Apple appears before that ever becomes a real problem. In the current project, there's never any very large text // views so I'm not worried too much about performance right now. // // This pretty much totally sucks and is just one of many places that using layer-backed NSViews has caused insane problems and resulted in // stupid workarounds or compromises. Frustration doesn't even being to cover it. The amazing thing, is that all this stuff appears to have // been broken since at least 10.5 when layers were first introduced. I suspect all the layer guys on the AppKit team were stolen for the // iOS team and it all fell *way* behind. I'm really hoping this crap is cleaned up in 10.7. Of course if they go ahead and just ship UIKit // in 10.7, I'll be kinda pissed about that, too... so... uh... yeah... - (void)setNeedsFakeSpellCheck { if ([self isContinuousSpellCheckingEnabled]) { [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(forcedSpellCheck) object:nil]; [self performSelector:@selector(forcedSpellCheck) withObject:nil afterDelay:0.5]; } } - (void)didChangeText { [super didChangeText]; [self setNeedsFakeSpellCheck]; } - (void)updateInsertionPointStateAndRestartTimer:(BOOL)flag { [super updateInsertionPointStateAndRestartTimer:flag]; [self setNeedsFakeSpellCheck]; } - (void)forcedSpellCheck { [self checkTextInRange:NSMakeRange(0,[[self string] length]) types:[self enabledTextCheckingTypes] options:@{}]; } // Because drawing the misspelling underline squiggle doesn't seem to work when the text view is used on a layer-backed NSView, we have to draw them // ourselves. In an attempt to be pro-active about avoiding potential problems if Apple were to fix this in 10.7, I'm returning nil in this // NSLayoutManager delegate method which should mean that it won't even try draw any temporary attributes - even if it can some day. - (NSDictionary *)layoutManager:(NSLayoutManager *)layoutManager shouldUseTemporaryAttributes:(NSDictionary *)attrs forDrawingToScreen:(BOOL)toScreen atCharacterIndex:(NSUInteger)charIndex effectiveRange:(NSRangePointer)effectiveCharRange { return nil; } // My attempt at drawing the underline dots as close to how stock OSX seems to draw them. It's not perfect, but to my eyes it's damn close. // This should not need to exist. - (void)drawFakeSpellingUnderlinesInRect:(NSRect)rect { CGFloat lineDash[2] = {0.75, 3.25}; NSBezierPath *underlinePath = [NSBezierPath bezierPath]; [underlinePath setLineDash:lineDash count:2 phase:0]; [underlinePath setLineWidth:2]; [underlinePath setLineCapStyle:NSRoundLineCapStyle]; NSLayoutManager *layout = [self layoutManager]; NSRange checkRange = NSMakeRange(0,[[self string] length]); while (checkRange.length > 0) { NSRange effectiveRange = NSMakeRange(checkRange.location,0); id spellingValue = [layout temporaryAttribute:NSSpellingStateAttributeName atCharacterIndex:checkRange.location longestEffectiveRange:&effectiveRange inRange:checkRange]; if (spellingValue) { const NSInteger spellingFlag = [spellingValue intValue]; if ((spellingFlag & NSSpellingStateSpellingFlag) == NSSpellingStateSpellingFlag) { NSUInteger count = 0; const NSRectArray rects = [layout rectArrayForCharacterRange:effectiveRange withinSelectedCharacterRange:NSMakeRange(NSNotFound,0) inTextContainer:[self textContainer] rectCount:&count]; for (NSUInteger i=0; i enum { UIDataDetectorTypePhoneNumber = 1 << 0, UIDataDetectorTypeLink = 1 << 1, UIDataDetectorTypeNone = 0, UIDataDetectorTypeAll = NSUIntegerMax }; typedef NSUInteger UIDataDetectorTypes; ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIDatePicker.h ================================================ /* * Copyright (c) 2011, Casey Marshall. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import #import "UIControl.h" typedef enum { UIDatePickerModeTime, UIDatePickerModeDate, UIDatePickerModeDateAndTime, UIDatePickerModeCountDownTimer } UIDatePickerMode; @interface UIDatePicker : UIControl { @private NSCalendar *_calendar; NSDate *_date; NSLocale *_locale; NSTimeZone *_timeZone; UIDatePickerMode _datePickerMode; NSDate *_minimumDate; NSDate *_maximumDate; NSInteger _minuteInterval; NSTimeInterval _countDownDuration; } @property (nonatomic, strong) NSCalendar *calendar; @property (nonatomic, strong) NSDate *date; @property (nonatomic, strong) NSLocale *locale; @property (nonatomic, strong) NSTimeZone *timeZone; @property (nonatomic, assign) UIDatePickerMode datePickerMode; @property (nonatomic, strong) NSDate *minimumDate; @property (nonatomic, strong) NSDate *maximumDate; @property (nonatomic, assign) NSInteger minuteInterval; @property (nonatomic, assign) NSTimeInterval countDownDuration; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIDatePicker.m ================================================ /* * Copyright (c) 2011, Casey Marshall. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIDatePicker.h" @implementation UIDatePicker @synthesize calendar = _calendar; @synthesize date = _date; @synthesize locale = _locale; @synthesize timeZone = _timeZone; @synthesize datePickerMode = _datePickerMode; @synthesize minimumDate = _minimumDate; @synthesize maximumDate = _maximumDate; @synthesize minuteInterval = _minuteInterval; @synthesize countDownDuration = _countDownDuration; - (void) dealloc { [_calendar release]; [_date release]; [_locale release]; [_timeZone release]; [_minimumDate release]; [_maximumDate release]; [super dealloc]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIDevice.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import extern NSString *const UIDeviceOrientationDidChangeNotification; typedef enum { UIDeviceOrientationUnknown, UIDeviceOrientationPortrait, UIDeviceOrientationPortraitUpsideDown, UIDeviceOrientationLandscapeLeft, UIDeviceOrientationLandscapeRight, UIDeviceOrientationFaceUp, UIDeviceOrientationFaceDown } UIDeviceOrientation; typedef enum { UIUserInterfaceIdiomPhone, UIUserInterfaceIdiomPad, UIUserInterfaceIdiomDesktop, } UIUserInterfaceIdiom; #define UI_USER_INTERFACE_IDIOM() \ ([[UIDevice currentDevice] respondsToSelector:@selector(userInterfaceIdiom)] ? \ [[UIDevice currentDevice] userInterfaceIdiom] : \ UIUserInterfaceIdiomPhone) #define UIDeviceOrientationIsPortrait(orientation) \ ((orientation) == UIDeviceOrientationPortrait || \ (orientation) == UIDeviceOrientationPortraitUpsideDown) #define UIDeviceOrientationIsLandscape(orientation) \ ((orientation) == UIDeviceOrientationLandscapeLeft || \ (orientation) == UIDeviceOrientationLandscapeRight) @interface UIDevice : NSObject { } + (UIDevice *)currentDevice; @property (nonatomic, readonly, strong) NSString *name; @property (nonatomic, readonly) UIUserInterfaceIdiom userInterfaceIdiom; // always returns UIUserInterfaceIdiomDesktop @property (nonatomic, readonly) UIDeviceOrientation orientation; // always returns UIDeviceOrientationPortrait @property (nonatomic, readonly,getter=isMultitaskingSupported) BOOL multitaskingSupported; // always returns YES @property (nonatomic, readonly, strong) NSString *systemName; @property (nonatomic, readonly, strong) NSString *systemVersion; @property (nonatomic, readonly, strong) NSString *model; @property (nonatomic, readonly, getter=isGeneratingDeviceOrientationNotifications) BOOL generatesDeviceOrientationNotifications; // aways returns NO - (void)beginGeneratingDeviceOrientationNotifications; // no effect - (void)endGeneratingDeviceOrientationNotifications; // no effect @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIDevice.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIDevice.h" #import #import NSString *const UIDeviceOrientationDidChangeNotification = @"UIDeviceOrientationDidChangeNotification"; static UIDevice *theDevice; @implementation UIDevice + (void)initialize { if (self == [UIDevice class]) { theDevice = [[UIDevice alloc] init]; } } + (UIDevice *)currentDevice { return theDevice; } - (UIUserInterfaceIdiom)userInterfaceIdiom { return UIUserInterfaceIdiomDesktop; } - (NSString *)name { return [(__bridge NSString *)SCDynamicStoreCopyComputerName(NULL,NULL) autorelease]; } - (UIDeviceOrientation)orientation { return UIDeviceOrientationPortrait; } - (BOOL)isMultitaskingSupported { return YES; } - (NSString *)systemName { return [[NSProcessInfo processInfo] operatingSystemName]; } - (NSString *)systemVersion { return [[NSProcessInfo processInfo] operatingSystemVersionString]; } - (NSString *)model { return @"Mac"; } - (BOOL)isGeneratingDeviceOrientationNotifications { return NO; } - (void)beginGeneratingDeviceOrientationNotifications { } - (void)endGeneratingDeviceOrientationNotifications { } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIEvent+UIPrivate.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIEvent.h" @interface UIEvent (UIPrivate) - (id)initWithEventType:(UIEventType)type; - (void)_setTouch:(UITouch *)touch; - (void)_setTimestamp:(NSTimeInterval)timestamp; - (void)_setUnhandledKeyPressEvent; - (BOOL)_isUnhandledKeyPressEvent; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIEvent.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import typedef enum { UIEventTypeTouches, UIEventTypeMotion, UIEventTypeKeyPress // AppKitIntegration } UIEventType; typedef enum { UIEventSubtypeNone = 0, UIEventSubtypeMotionShake = 1, } UIEventSubtype; @class UITouch, UIWindow, UIView, UIGestureRecognizer; @interface UIEvent : NSObject { @private UIEventType _type; UITouch *_touch; NSTimeInterval _timestamp; BOOL _unhandledKeyPressEvent; } @property (nonatomic, readonly) NSTimeInterval timestamp; - (NSSet *)allTouches; - (NSSet *)touchesForView:(UIView *)view; - (NSSet *)touchesForWindow:(UIWindow *)window; - (NSSet *)touchesForGestureRecognizer:(UIGestureRecognizer *)gesture; @property (nonatomic, readonly) UIEventType type; @property (nonatomic, readonly) UIEventSubtype subtype; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIEvent.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIEvent+UIPrivate.h" #import "UITouch.h" @implementation UIEvent @synthesize timestamp=_timestamp, type=_type; - (id)initWithEventType:(UIEventType)type { if ((self=[super init])) { _type = type; _unhandledKeyPressEvent = NO; } return self; } - (void)dealloc { [_touch release]; [super dealloc]; } - (void)_setTouch:(UITouch *)t { if (_touch != t) { [_touch release]; _touch = [t retain]; } } - (void)_setTimestamp:(NSTimeInterval)timestamp { _timestamp = timestamp; } // this is stupid hack so that keyboard events can fall to AppKit's next responder if nothing within UIKit handles it // I couldn't come up with a better way at the time. meh. - (void)_setUnhandledKeyPressEvent { _unhandledKeyPressEvent = YES; } - (BOOL)_isUnhandledKeyPressEvent { return _unhandledKeyPressEvent; } - (NSSet *)allTouches { return [NSSet setWithObject:_touch]; } - (NSSet *)touchesForView:(UIView *)view { NSMutableSet *touches = [NSMutableSet setWithCapacity:1]; for (UITouch *touch in [self allTouches]) { if (touch.view == view) { [touches addObject:touch]; } } return touches; } - (NSSet *)touchesForWindow:(UIWindow *)window { NSMutableSet *touches = [NSMutableSet setWithCapacity:1]; for (UITouch *touch in [self allTouches]) { if (touch.window == window) { [touches addObject:touch]; } } return touches; } - (NSSet *)touchesForGestureRecognizer:(UIGestureRecognizer *)gesture { NSMutableSet *touches = [NSMutableSet setWithCapacity:1]; for (UITouch *touch in [self allTouches]) { if ([touch.gestureRecognizers containsObject:gesture]) { [touches addObject:touch]; } } return touches; } - (UIEventSubtype)subtype { return UIEventSubtypeNone; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIFont+UIPrivate.h ================================================ // // UIFont+UIPrivate.h // UIKit // // Created by Jim Dovey on 11-03-23. // /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIFont.h" @class NSFont; @interface UIFont (UIPrivate) + (UIFont *)fontWithNSFont:(NSFont *)aFont; - (NSFont *)NSFont; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIFont.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @interface UIFont : NSObject { @package CTFontRef _font; } + (UIFont *)fontWithName:(NSString *)fontName size:(CGFloat)fontSize; + (NSArray *)familyNames; + (NSArray *)fontNamesForFamilyName:(NSString *)familyName; + (UIFont *)systemFontOfSize:(CGFloat)fontSize; + (UIFont *)boldSystemFontOfSize:(CGFloat)fontSize; - (UIFont *)fontWithSize:(CGFloat)fontSize; @property (nonatomic, readonly, strong) NSString *fontName; @property (nonatomic, readonly) CGFloat ascender; @property (nonatomic, readonly) CGFloat descender; @property (nonatomic, readonly) CGFloat lineHeight; @property (nonatomic, readonly) CGFloat pointSize; @property (nonatomic, readonly) CGFloat xHeight; @property (nonatomic, readonly) CGFloat capHeight; @property (nonatomic, readonly, strong) NSString *familyName; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIFont.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIFont.h" #import static NSString *UIFontSystemFontName = nil; static NSString *UIFontBoldSystemFontName = nil; @implementation UIFont + (void)setSystemFontName:(NSString *)aName { [UIFontSystemFontName release]; UIFontSystemFontName = [aName copy]; } + (void)setBoldSystemFontName:(NSString *)aName { [UIFontBoldSystemFontName release]; UIFontBoldSystemFontName = [aName copy]; } + (UIFont *)_fontWithCTFont:(CTFontRef)aFont { UIFont *theFont = [[UIFont alloc] init]; theFont->_font = CFRetain(aFont); return [theFont autorelease]; } + (UIFont *)fontWithNSFont:(NSFont *)aFont { if (aFont) { CTFontRef newFont = CTFontCreateWithName((__bridge CFStringRef)[aFont fontName], [aFont pointSize], NULL); if (newFont) { UIFont *theFont = [self _fontWithCTFont:newFont]; CFRelease(newFont); return theFont; } } return nil; } + (UIFont *)fontWithName:(NSString *)fontName size:(CGFloat)fontSize { return [self fontWithNSFont:[NSFont fontWithName:fontName size:fontSize]]; } static NSArray *_getFontCollectionNames(CTFontCollectionRef collection, CFStringRef nameAttr) { NSMutableSet *names = [NSMutableSet set]; if (collection) { CFArrayRef descriptors = CTFontCollectionCreateMatchingFontDescriptors(collection); if (descriptors) { NSInteger count = CFArrayGetCount(descriptors); for (NSInteger i = 0; i < count; i++) { CTFontDescriptorRef descriptor = (CTFontDescriptorRef) CFArrayGetValueAtIndex(descriptors, i); CFTypeRef name = CTFontDescriptorCopyAttribute(descriptor, nameAttr); if(name) { if (CFGetTypeID(name) == CFStringGetTypeID()) { [names addObject:(__bridge NSString*)name]; } CFRelease(name); } } CFRelease(descriptors); } } return [names allObjects]; } + (NSArray *)familyNames { CTFontCollectionRef collection = CTFontCollectionCreateFromAvailableFonts(NULL); NSArray* names = _getFontCollectionNames(collection, kCTFontFamilyNameAttribute); if (collection) { CFRelease(collection); } return names; } + (NSArray *)fontNamesForFamilyName:(NSString *)familyName { NSArray *names = nil; CTFontDescriptorRef descriptor = CTFontDescriptorCreateWithAttributes((__bridge CFDictionaryRef) [NSDictionary dictionaryWithObjectsAndKeys: familyName, (NSString*)kCTFontFamilyNameAttribute, nil, nil]); if (descriptor) { CFArrayRef descriptors = CFArrayCreate(NULL, (CFTypeRef*) &descriptor, 1, &kCFTypeArrayCallBacks); if (descriptors) { CTFontCollectionRef collection = CTFontCollectionCreateWithFontDescriptors(descriptors, NULL); names = _getFontCollectionNames(collection, kCTFontNameAttribute); if (collection) { CFRelease(collection); } CFRelease(descriptors); } CFRelease(descriptor); } return names; } + (UIFont *)systemFontOfSize:(CGFloat)fontSize { NSFont *systemFont = UIFontSystemFontName? [NSFont fontWithName:UIFontSystemFontName size:fontSize] : [NSFont systemFontOfSize:fontSize]; return [self fontWithNSFont:systemFont]; } + (UIFont *)boldSystemFontOfSize:(CGFloat)fontSize { NSFont *systemFont = UIFontBoldSystemFontName? [NSFont fontWithName:UIFontBoldSystemFontName size:fontSize] : [NSFont boldSystemFontOfSize:fontSize]; return [self fontWithNSFont:systemFont]; } - (void)dealloc { if (_font) CFRelease(_font); [super dealloc]; } - (NSString *)fontName { return [(NSString *)CTFontCopyFullName(_font) autorelease]; } - (CGFloat)ascender { return CTFontGetAscent(_font); } - (CGFloat)descender { return -CTFontGetDescent(_font); } - (CGFloat)pointSize { return CTFontGetSize(_font); } - (CGFloat)xHeight { return CTFontGetXHeight(_font); } - (CGFloat)capHeight { return CTFontGetCapHeight(_font); } - (CGFloat)lineHeight { // this seems to compute heights that are very close to what I'm seeing on iOS for fonts at // the same point sizes. however there's still subtle differences between fonts on the two // platforms (iOS and Mac) and I don't know if it's ever going to be possible to make things // return exactly the same values in all cases. return ceilf(self.ascender) - floorf(self.descender) + ceilf(CTFontGetLeading(_font)); } - (NSString *)familyName { return [(NSString *)CTFontCopyFamilyName(_font) autorelease]; } - (UIFont *)fontWithSize:(CGFloat)fontSize { CTFontRef newFont = CTFontCreateCopyWithAttributes(_font, fontSize, NULL, NULL); if (newFont) { UIFont *theFont = [[self class] _fontWithCTFont:newFont]; CFRelease(newFont); return theFont; } else { return nil; } } - (NSFont *)NSFont { return [NSFont fontWithName:self.fontName size:self.pointSize]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIFontAppKitIntegration.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIFont.h" @class NSFont; @interface UIFont (AppKitIntegration) + (UIFont *)fontWithNSFont:(NSFont *)aFont; - (NSFont *)NSFont; // these override the use of OSX's default system fonts, set to nil to use OSX default + (void)setSystemFontName:(NSString *)aName; + (void)setBoldSystemFontName:(NSString *)aName; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIGeometry.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import #import typedef struct UIEdgeInsets { CGFloat top, left, bottom, right; // specify amount to inset (positive) for each of the edges. values can be negative to 'outset' } UIEdgeInsets; static inline UIEdgeInsets UIEdgeInsetsMake(CGFloat top, CGFloat left, CGFloat bottom, CGFloat right) { return (UIEdgeInsets){top, left, bottom, right}; } static inline CGRect UIEdgeInsetsInsetRect(CGRect rect, UIEdgeInsets insets) { rect.origin.x += insets.left; rect.origin.y += insets.top; rect.size.width -= (insets.left + insets.right); rect.size.height -= (insets.top + insets.bottom); return rect; } static inline BOOL UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsets insets1, UIEdgeInsets insets2) { return CGRectEqualToRect(CGRectMake(insets1.left, insets1.top, insets1.right, insets1.bottom), CGRectMake(insets2.left, insets2.top, insets2.right, insets2.bottom)); } extern const UIEdgeInsets UIEdgeInsetsZero; typedef struct UIOffset { CGFloat horizontal, vertical; } UIOffset; static inline UIOffset UIOffsetMake(CGFloat horizontal, CGFloat vertical) { return (UIOffset){horizontal, vertical}; } static inline BOOL UIOffsetEqualToOffset(UIOffset offset1, UIOffset offset2) { return offset1.horizontal == offset2.horizontal && offset1.vertical == offset2.vertical; } extern const UIOffset UIOffsetZero; NSString *NSStringFromCGPoint(CGPoint p); NSString *NSStringFromCGRect(CGRect r); NSString *NSStringFromCGSize(CGSize s); NSString *NSStringFromCGAffineTransform(CGAffineTransform transform); NSString *NSStringFromUIEdgeInsets(UIEdgeInsets insets); NSString *NSStringFromUIOffset(UIOffset offset); @interface NSValue (NSValueUIGeometryExtensions) + (NSValue *)valueWithCGPoint:(CGPoint)point; + (NSValue *)valueWithCGRect:(CGRect)rect; + (NSValue *)valueWithCGSize:(CGSize)size; + (NSValue *)valueWithUIEdgeInsets:(UIEdgeInsets)insets; + (NSValue *)valueWithUIOffset:(UIOffset)offset; - (CGPoint)CGPointValue; - (CGRect)CGRectValue; - (CGSize)CGSizeValue; - (UIEdgeInsets)UIEdgeInsetsValue; - (UIOffset)UIOffsetValue; @end @interface NSCoder (NSCoderUIGeometryExtensions) - (void)encodeCGPoint:(CGPoint)point forKey:(NSString *)key; - (CGPoint)decodeCGPointForKey:(NSString *)key; - (void)encodeCGRect:(CGRect)rect forKey:(NSString *)key; - (CGRect)decodeCGRectForKey:(NSString *)key; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIGeometry.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIGeometry.h" const UIEdgeInsets UIEdgeInsetsZero = {0,0,0,0}; const UIOffset UIOffsetZero = {0,0}; NSString *NSStringFromCGPoint(CGPoint p) { return NSStringFromPoint(NSPointFromCGPoint(p)); } NSString *NSStringFromCGRect(CGRect r) { return NSStringFromRect(NSRectFromCGRect(r)); } NSString *NSStringFromCGSize(CGSize s) { return NSStringFromSize(NSSizeFromCGSize(s)); } NSString *NSStringFromCGAffineTransform(CGAffineTransform transform) { return [NSString stringWithFormat:@"[%g, %g, %g, %g, %g, %g]", transform.a, transform.b, transform.c, transform.d, transform.tx, transform.ty]; } NSString *NSStringFromUIEdgeInsets(UIEdgeInsets insets) { return [NSString stringWithFormat:@"{%g, %g, %g, %g}", insets.top, insets.left, insets.bottom, insets.right]; } NSString *NSStringFromUIOffset(UIOffset offset) { return [NSString stringWithFormat:@"{%g, %g}", offset.horizontal, offset.vertical]; } @implementation NSValue (NSValueUIGeometryExtensions) + (NSValue *)valueWithCGPoint:(CGPoint)point { return [NSValue valueWithPoint:NSPointFromCGPoint(point)]; } - (CGPoint)CGPointValue { return NSPointToCGPoint([self pointValue]); } + (NSValue *)valueWithCGRect:(CGRect)rect { return [NSValue valueWithRect:NSRectFromCGRect(rect)]; } - (CGRect)CGRectValue { return NSRectToCGRect([self rectValue]); } + (NSValue *)valueWithCGSize:(CGSize)size { return [NSValue valueWithSize:NSSizeFromCGSize(size)]; } - (CGSize)CGSizeValue { return NSSizeToCGSize([self sizeValue]); } + (NSValue *)valueWithUIEdgeInsets:(UIEdgeInsets)insets { return [NSValue valueWithBytes: &insets objCType: @encode(UIEdgeInsets)]; } - (UIEdgeInsets)UIEdgeInsetsValue { if(strcmp([self objCType], @encode(UIEdgeInsets)) == 0) { UIEdgeInsets insets; [self getValue: &insets]; return insets; } return UIEdgeInsetsZero; } + (NSValue *)valueWithUIOffset:(UIOffset)offset { return [NSValue valueWithBytes: &offset objCType: @encode(UIOffset)]; } - (UIOffset)UIOffsetValue { if(strcmp([self objCType], @encode(UIOffset)) == 0) { UIOffset offset; [self getValue: &offset]; return offset; } return UIOffsetZero; } @end @implementation NSCoder (NSCoderUIGeometryExtensions) - (void)encodeCGPoint:(CGPoint)point forKey:(NSString *)key { [self encodePoint:NSPointFromCGPoint(point) forKey:key]; } - (CGPoint)decodeCGPointForKey:(NSString *)key { return NSPointToCGPoint([self decodePointForKey:key]); } - (void)encodeCGRect:(CGRect)rect forKey:(NSString *)key { [self encodeRect:NSRectFromCGRect(rect) forKey:key]; } - (CGRect)decodeCGRectForKey:(NSString *)key { return NSRectToCGRect([self decodeRectForKey:key]); } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIGestureRecognizer+UIPrivate.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIGestureRecognizer.h" @interface UIGestureRecognizer (UIPrivate) - (void)_setView:(UIView *)v; - (void)_recognizeTouches:(NSSet *)touches withEvent:(UIEvent *)event; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIGestureRecognizer.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import typedef enum { UIGestureRecognizerStatePossible, UIGestureRecognizerStateBegan, UIGestureRecognizerStateChanged, UIGestureRecognizerStateEnded, UIGestureRecognizerStateCancelled, UIGestureRecognizerStateFailed, UIGestureRecognizerStateRecognized = UIGestureRecognizerStateEnded } UIGestureRecognizerState; @class UIView, UIGestureRecognizer, UITouch, UIEvent; @protocol UIGestureRecognizerDelegate @optional - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer; - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch; - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer; @end @interface UIGestureRecognizer : NSObject { @private __unsafe_unretained id _delegate; BOOL _delaysTouchesBegan; BOOL _delaysTouchesEnded; BOOL _cancelsTouchesInView; BOOL _enabled; UIGestureRecognizerState _state; UIView *_view; NSMutableArray *_registeredActions; NSMutableArray *_trackingTouches; struct { unsigned shouldBegin : 1; unsigned shouldReceiveTouch : 1; unsigned shouldRecognizeSimultaneouslyWithGestureRecognizer : 1; } _delegateHas; } - (id)initWithTarget:(id)target action:(SEL)action; - (void)addTarget:(id)target action:(SEL)action; - (void)removeTarget:(id)target action:(SEL)action; - (void)requireGestureRecognizerToFail:(UIGestureRecognizer *)otherGestureRecognizer; - (CGPoint)locationInView:(UIView *)view; - (NSUInteger)numberOfTouches; @property (nonatomic, assign) id delegate; @property (nonatomic) BOOL delaysTouchesBegan; @property (nonatomic) BOOL delaysTouchesEnded; @property (nonatomic) BOOL cancelsTouchesInView; @property (nonatomic, getter=isEnabled) BOOL enabled; @property (nonatomic, readonly) UIGestureRecognizerState state; @property (nonatomic, readonly) UIView *view; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIGestureRecognizer.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIGestureRecognizer.h" #import "UIGestureRecognizerSubclass.h" #import "UITouch+UIPrivate.h" #import "UIAction.h" #import "UIApplication.h" @implementation UIGestureRecognizer @synthesize delegate=_delegate, delaysTouchesBegan=_delaysTouchesBegan, delaysTouchesEnded=_delaysTouchesEnded, cancelsTouchesInView=_cancelsTouchesInView; @synthesize state=_state, enabled=_enabled, view=_view; - (id)initWithTarget:(id)target action:(SEL)action { if ((self=[super init])) { _state = UIGestureRecognizerStatePossible; _cancelsTouchesInView = YES; _delaysTouchesBegan = NO; _delaysTouchesEnded = YES; _enabled = YES; _registeredActions = [[NSMutableArray alloc] initWithCapacity:1]; _trackingTouches = [[NSMutableArray alloc] initWithCapacity:1]; [self addTarget:target action:action]; } return self; } - (void)dealloc { [_registeredActions release]; [_trackingTouches release]; [super dealloc]; } - (void)_setView:(UIView *)v { [self reset]; // not sure about this, but it kinda makes sense _view = v; } - (void)setDelegate:(id)aDelegate { if (aDelegate != _delegate) { _delegate = aDelegate; _delegateHas.shouldBegin = [_delegate respondsToSelector:@selector(gestureRecognizerShouldBegin:)]; _delegateHas.shouldReceiveTouch = [_delegate respondsToSelector:@selector(gestureRecognizer:shouldReceiveTouch:)]; _delegateHas.shouldRecognizeSimultaneouslyWithGestureRecognizer = [_delegate respondsToSelector:@selector(gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:)]; } } - (void)addTarget:(id)target action:(SEL)action { NSAssert(target != nil, @"target must not be nil"); NSAssert(action != NULL, @"action must not be NULL"); UIAction *actionRecord = [[UIAction alloc] init]; actionRecord.target = target; actionRecord.action = action; [_registeredActions addObject:actionRecord]; [actionRecord release]; } - (void)removeTarget:(id)target action:(SEL)action { UIAction *actionRecord = [[UIAction alloc] init]; actionRecord.target = target; actionRecord.action = action; [_registeredActions removeObject:actionRecord]; [actionRecord release]; } - (void)requireGestureRecognizerToFail:(UIGestureRecognizer *)otherGestureRecognizer { } - (NSUInteger)numberOfTouches { return [_trackingTouches count]; } - (CGPoint)locationInView:(UIView *)view { // by default, this should compute the centroid of all the involved points // of course as of this writing, Chameleon only supports one point but at least // it may be semi-correct if that ever changes. :D YAY FOR COMPLEXITY! CGFloat x = 0; CGFloat y = 0; CGFloat k = 0; for (UITouch *touch in _trackingTouches) { const CGPoint p = [touch locationInView:view]; x += p.x; y += p.y; k++; } if (k > 0) { return CGPointMake(x/k, y/k); } else { return CGPointZero; } } - (CGPoint)locationOfTouch:(NSUInteger)touchIndex inView:(UIView *)view { return [[_trackingTouches objectAtIndex:touchIndex] locationInView:view]; } - (void)setState:(UIGestureRecognizerState)state { // the docs didn't say explicitly if these state transitions were verified, but I suspect they are. if anything, a check like this // should help debug things. it also helps me better understand the whole thing, so it's not a total waste of time :) typedef struct { UIGestureRecognizerState fromState, toState; BOOL shouldNotify, shouldReset; } StateTransition; #define NumberOfStateTransitions 9 static const StateTransition allowedTransitions[NumberOfStateTransitions] = { // discrete gestures {UIGestureRecognizerStatePossible, UIGestureRecognizerStateRecognized, YES, YES}, {UIGestureRecognizerStatePossible, UIGestureRecognizerStateFailed, NO, YES}, // continuous gestures {UIGestureRecognizerStatePossible, UIGestureRecognizerStateBegan, YES, NO }, {UIGestureRecognizerStateBegan, UIGestureRecognizerStateChanged, YES, NO }, {UIGestureRecognizerStateBegan, UIGestureRecognizerStateCancelled, YES, YES}, {UIGestureRecognizerStateBegan, UIGestureRecognizerStateEnded, YES, YES}, {UIGestureRecognizerStateChanged, UIGestureRecognizerStateChanged, YES, NO }, {UIGestureRecognizerStateChanged, UIGestureRecognizerStateCancelled, YES, YES}, {UIGestureRecognizerStateChanged, UIGestureRecognizerStateEnded, YES, YES} }; const StateTransition *transition = NULL; for (NSUInteger t=0; ttoState; if (transition->shouldNotify) { for (UIAction *actionRecord in _registeredActions) { // docs mention that the action messages are sent on the next run loop, so we'll do that here. // note that this means that reset can't happen until the next run loop, either otherwise // the state property is going to be wrong when the action handler looks at it, so as a result // I'm also delaying the reset call (if necessary) just below here. [actionRecord.target performSelector:actionRecord.action withObject:self afterDelay:0]; } } if (transition->shouldReset) { // see note above about the delay [self performSelector:@selector(reset) withObject:nil afterDelay:0]; } } } - (void)reset { _state = UIGestureRecognizerStatePossible; [_trackingTouches removeAllObjects]; } - (BOOL)canPreventGestureRecognizer:(UIGestureRecognizer *)preventedGestureRecognizer { return YES; } - (BOOL)canBePreventedByGestureRecognizer:(UIGestureRecognizer *)preventingGestureRecognizer { return YES; } - (void)ignoreTouch:(UITouch *)touch forEvent:(UIEvent*)event { } - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { } - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { } - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { } - (void)_gesturesBegan:(NSSet *)touches withEvent:(UIEvent *)event { } - (void)_gesturesMoved:(NSSet *)touches withEvent:(UIEvent *)event { } - (void)_gesturesEnded:(NSSet *)touches withEvent:(UIEvent *)event { } - (void)_discreteGestures:(NSSet *)touches withEvent:(UIEvent *)event { } - (BOOL)_shouldAttemptToRecognize { return (self.enabled && self.state != UIGestureRecognizerStateFailed && self.state != UIGestureRecognizerStateCancelled && self.state != UIGestureRecognizerStateEnded); } - (void)_recognizeTouches:(NSSet *)touches withEvent:(UIEvent *)event { if ([self _shouldAttemptToRecognize]) { [_trackingTouches setArray:[touches allObjects]]; for (UITouch *touch in _trackingTouches) { switch (touch.phase) { case UITouchPhaseBegan: [self touchesBegan:touches withEvent:event]; break; case UITouchPhaseMoved: [self touchesMoved:touches withEvent:event]; break; case UITouchPhaseEnded: [self touchesEnded:touches withEvent:event]; break; case UITouchPhaseCancelled: [self touchesCancelled:touches withEvent:event]; break; case _UITouchPhaseGestureBegan: [self _gesturesBegan:touches withEvent:event]; break; case _UITouchPhaseGestureChanged: [self _gesturesMoved:touches withEvent:event]; break; case _UITouchPhaseGestureEnded: [self _gesturesEnded:touches withEvent:event]; break; case _UITouchPhaseDiscreteGesture: [self _discreteGestures:touches withEvent:event]; break; default: break; } } } } - (NSString *)description { NSString *state = @""; switch (self.state) { case UIGestureRecognizerStatePossible: state = @"Possible"; break; case UIGestureRecognizerStateBegan: state = @"Began"; break; case UIGestureRecognizerStateChanged: state = @"Changed"; break; case UIGestureRecognizerStateEnded: state = @"Ended"; break; case UIGestureRecognizerStateCancelled: state = @"Cancelled"; break; case UIGestureRecognizerStateFailed: state = @"Failed"; break; } return [NSString stringWithFormat:@"<%@: %p; state = %@; view = %@>", [self className], self, state, self.view]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIGestureRecognizerSubclass.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIGestureRecognizer.h" @interface UIGestureRecognizer () @property (nonatomic,readwrite) UIGestureRecognizerState state; - (void)ignoreTouch:(UITouch *)touch forEvent:(UIEvent*)event; // don't override // override, but be sure to call super - (void)reset; - (BOOL)canPreventGestureRecognizer:(UIGestureRecognizer *)preventedGestureRecognizer; - (BOOL)canBePreventedByGestureRecognizer:(UIGestureRecognizer *)preventingGestureRecognizer; - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event; - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event; - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event; - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIGraphics.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @class UIImage; #ifdef __cplusplus extern "C" { #endif void UIGraphicsPushContext(CGContextRef ctx); void UIGraphicsPopContext(void); CGContextRef UIGraphicsGetCurrentContext(void); CGFloat _UIGraphicsGetContextScaleFactor(CGContextRef ctx); void UIGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGFloat scale); void UIGraphicsBeginImageContext(CGSize size); UIImage *UIGraphicsGetImageFromCurrentImageContext(void); void UIGraphicsEndImageContext(void); void UIRectClip(CGRect rect); void UIRectFill(CGRect rect); void UIRectFillUsingBlendMode(CGRect rect, CGBlendMode blendMode); void UIRectFrame(CGRect rect); void UIRectFrameUsingBlendMode(CGRect rect, CGBlendMode blendMode); #ifdef __cplusplus } #endif ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIGraphics.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIGraphics.h" #import "UIImage.h" #import "UIScreen.h" #import static NSMutableArray *contextStack = nil; static NSMutableArray *imageContextStack = nil; void UIGraphicsPushContext(CGContextRef ctx) { if (!contextStack) { contextStack = [[NSMutableArray alloc] initWithCapacity:1]; } if ([NSGraphicsContext currentContext]) { [contextStack addObject:[NSGraphicsContext currentContext]]; } [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithGraphicsPort:(void *)ctx flipped:YES]]; } void UIGraphicsPopContext() { if ([contextStack lastObject]) { [NSGraphicsContext setCurrentContext:[contextStack lastObject]]; [contextStack removeLastObject]; } } CGContextRef UIGraphicsGetCurrentContext() { return [[NSGraphicsContext currentContext] graphicsPort]; } CGFloat _UIGraphicsGetContextScaleFactor(CGContextRef ctx) { const CGRect rect = CGContextGetClipBoundingBox(ctx); const CGRect deviceRect = CGContextConvertRectToDeviceSpace(ctx, rect); const CGFloat scale = deviceRect.size.height / rect.size.height; return scale; } void UIGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGFloat scale) { if (scale == 0.f) { scale = [UIScreen mainScreen].scale; } const size_t width = size.width * scale; const size_t height = size.height * scale; if (width > 0 && height > 0) { if (!imageContextStack) { imageContextStack = [[NSMutableArray alloc] initWithCapacity:1]; } [imageContextStack addObject:[NSNumber numberWithFloat:scale]]; CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef ctx = CGBitmapContextCreate(NULL, width, height, 8, 4*width, colorSpace, (opaque? kCGImageAlphaNoneSkipFirst : kCGImageAlphaPremultipliedFirst)); CGContextConcatCTM(ctx, CGAffineTransformMake(1, 0, 0, -1, 0, height)); CGContextScaleCTM(ctx, scale, scale); CGColorSpaceRelease(colorSpace); UIGraphicsPushContext(ctx); CGContextRelease(ctx); } } void UIGraphicsBeginImageContext(CGSize size) { UIGraphicsBeginImageContextWithOptions(size, NO, 1.f); } UIImage *UIGraphicsGetImageFromCurrentImageContext() { if ([imageContextStack lastObject]) { const CGFloat scale = [[imageContextStack lastObject] floatValue]; CGImageRef theCGImage = CGBitmapContextCreateImage(UIGraphicsGetCurrentContext()); UIImage *image = [UIImage imageWithCGImage:theCGImage scale:scale orientation:UIImageOrientationUp]; CGImageRelease(theCGImage); return image; } else { return nil; } } void UIGraphicsEndImageContext() { if ([imageContextStack lastObject]) { [imageContextStack removeLastObject]; UIGraphicsPopContext(); } } void UIRectClip(CGRect rect) { CGContextClipToRect(UIGraphicsGetCurrentContext(), rect); } void UIRectFill(CGRect rect) { UIRectFillUsingBlendMode(rect, kCGBlendModeCopy); } void UIRectFillUsingBlendMode(CGRect rect, CGBlendMode blendMode) { CGContextRef c = UIGraphicsGetCurrentContext(); CGContextSaveGState(c); CGContextSetBlendMode(c, blendMode); CGContextFillRect(c, rect); CGContextRestoreGState(c); } void UIRectFrame(CGRect rect) { CGContextStrokeRect(UIGraphicsGetCurrentContext(), rect); } void UIRectFrameUsingBlendMode(CGRect rect, CGBlendMode blendMode) { CGContextRef c = UIGraphicsGetCurrentContext(); CGContextSaveGState(c); CGContextSetBlendMode(c, blendMode); UIRectFrame(rect); CGContextRestoreGState(c); } ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIImage+UIPrivate.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIImage.h" @class NSImage, UIImageRep; @interface UIImage (UIPrivate) + (void)_cacheImage:(UIImage *)image forName:(NSString *)name; + (UIImage *)_cachedImageForName:(NSString *)name; + (UIImage *)_backButtonImage; + (UIImage *)_highlightedBackButtonImage; + (UIImage *)_toolbarButtonImage; + (UIImage *)_highlightedToolbarButtonImage; + (UIImage *)_leftPopoverArrowImage; + (UIImage *)_rightPopoverArrowImage; + (UIImage *)_topPopoverArrowImage; + (UIImage *)_bottomPopoverArrowImage; + (UIImage *)_popoverBackgroundImage; + (UIImage *)_roundedRectButtonImage; + (UIImage *)_highlightedRoundedRectButtonImage; + (UIImage *)_windowResizeGrabberImage; + (UIImage *)_buttonBarSystemItemAdd; + (UIImage *)_buttonBarSystemItemReply; + (UIImage *)_tabBarBackgroundImage; + (UIImage *)_tabBarItemImage; - (id)_initWithRepresentations:(NSArray *)reps; - (UIImageRep *)_bestRepresentationForProposedScale:(CGFloat)scale; - (void)_drawRepresentation:(UIImageRep *)rep inRect:(CGRect)rect; - (NSArray *)_representations; - (BOOL)_isOpaque; - (UIImage *)_toolbarImage; // returns a new image which is modified as required for toolbar buttons (turned into a solid color) @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIImage+UIPrivate.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIImage+UIPrivate.h" #import "UIImageAppKitIntegration.h" #import "UIColor.h" #import "UIGraphics.h" #import "UIImageRep.h" #import NSMutableDictionary *imageCache = nil; @implementation UIImage (UIPrivate) + (void)load { imageCache = [[NSMutableDictionary alloc] init]; } + (void)_cacheImage:(UIImage *)image forName:(NSString *)name { if (image && name) { [imageCache setObject:image forKey:name]; } } + (UIImage *)_cachedImageForName:(NSString *)name { return [imageCache objectForKey:name]; } + (UIImage *)_frameworkImageWithName:(NSString *)name leftCapWidth:(NSUInteger)leftCapWidth topCapHeight:(NSUInteger)topCapHeight { UIImage *image = [self _cachedImageForName:name]; if (!image) { NSBundle *frameworkBundle = [NSBundle bundleWithIdentifier:@"org.chameleonproject.UIKit"]; NSString *frameworkFile = [[frameworkBundle resourcePath] stringByAppendingPathComponent:name]; image = [[self imageWithContentsOfFile:frameworkFile] stretchableImageWithLeftCapWidth:leftCapWidth topCapHeight:topCapHeight]; [self _cacheImage:image forName:name]; } return image; } + (UIImage *)_backButtonImage { return [self _frameworkImageWithName:@" back.png" leftCapWidth:18 topCapHeight:0]; } + (UIImage *)_highlightedBackButtonImage { return [self _frameworkImageWithName:@" back-highlighted.png" leftCapWidth:18 topCapHeight:0]; } + (UIImage *)_toolbarButtonImage { return [self _frameworkImageWithName:@" button.png" leftCapWidth:6 topCapHeight:0]; } + (UIImage *)_highlightedToolbarButtonImage { return [self _frameworkImageWithName:@" button-highlighted.png" leftCapWidth:6 topCapHeight:0]; } + (UIImage *)_leftPopoverArrowImage { return [self _frameworkImageWithName:@" arrow-left.png" leftCapWidth:0 topCapHeight:0]; } + (UIImage *)_rightPopoverArrowImage { return [self _frameworkImageWithName:@" arrow-right.png" leftCapWidth:0 topCapHeight:0]; } + (UIImage *)_topPopoverArrowImage { return [self _frameworkImageWithName:@" arrow-top.png" leftCapWidth:0 topCapHeight:0]; } + (UIImage *)_bottomPopoverArrowImage { return [self _frameworkImageWithName:@" arrow-bottom.png" leftCapWidth:0 topCapHeight:0]; } + (UIImage *)_popoverBackgroundImage { return [self _frameworkImageWithName:@" background.png" leftCapWidth:23 topCapHeight:23]; } + (UIImage *)_roundedRectButtonImage { return [self _frameworkImageWithName:@" normal.png" leftCapWidth:12 topCapHeight:9]; } + (UIImage *)_highlightedRoundedRectButtonImage { return [self _frameworkImageWithName:@" highlighted.png" leftCapWidth:12 topCapHeight:9]; } + (UIImage *)_windowResizeGrabberImage { return [self _frameworkImageWithName:@" grabber.png" leftCapWidth:0 topCapHeight:0]; } + (UIImage *)_buttonBarSystemItemAdd { return [self _frameworkImageWithName:@" add.png" leftCapWidth:0 topCapHeight:0]; } + (UIImage *)_buttonBarSystemItemReply { return [self _frameworkImageWithName:@" reply.png" leftCapWidth:0 topCapHeight:0]; } + (UIImage *)_tabBarBackgroundImage { return [self _frameworkImageWithName:@" background.png" leftCapWidth:6 topCapHeight:0]; } + (UIImage *)_tabBarItemImage { return [self _frameworkImageWithName:@" item.png" leftCapWidth:8 topCapHeight:0]; } - (id)_initWithRepresentations:(NSArray *)reps { if ([reps count] == 0) { [self release]; self = nil; } else if ((self=[super init])) { _representations = [reps copy]; } return self; } - (NSArray *)_representations { return _representations; } - (UIImageRep *)_bestRepresentationForProposedScale:(CGFloat)scale { UIImageRep *bestRep = nil; for (UIImageRep *rep in [self _representations]) { if (rep.scale > scale) { break; } else { bestRep = rep; } } return bestRep ?: [[self _representations] lastObject]; } - (BOOL)_isOpaque { for (UIImageRep *rep in [self _representations]) { if (!rep.opaque) { return NO; } } return YES; } - (void)_drawRepresentation:(UIImageRep *)rep inRect:(CGRect)rect { [rep drawInRect:rect fromRect:CGRectNull]; } - (UIImage *)_toolbarImage { // NOTE.. I don't know where to put this, really, but it seems like the real UIKit reduces image size by 75% if they are too // big for a toolbar. That seems funky, but I guess here is as good a place as any to do that? I don't really know... CGSize imageSize = self.size; CGSize size = CGSizeZero; if (imageSize.width > 24 || imageSize.height > 24) { size.height = imageSize.height * 0.75f; size.width = imageSize.width / imageSize.height * size.height; } else { size = imageSize; } CGRect rect = CGRectMake(0,0,size.width,size.height); UIGraphicsBeginImageContextWithOptions(size, NO, self.scale); [[UIColor colorWithRed:101/255.f green:104/255.f blue:121/255.f alpha:1] setFill]; UIRectFill(rect); [self drawInRect:rect blendMode:kCGBlendModeDestinationIn alpha:1]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return image; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIImage.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import typedef enum { UIImageOrientationUp, UIImageOrientationDown, // 180 deg rotation UIImageOrientationLeft, // 90 deg CCW UIImageOrientationRight, // 90 deg CW UIImageOrientationUpMirrored, // as above but image mirrored along // other axis. horizontal flip UIImageOrientationDownMirrored, // horizontal flip UIImageOrientationLeftMirrored, // vertical flip UIImageOrientationRightMirrored, // vertical flip } UIImageOrientation; @interface UIImage : NSObject { @private NSArray *_representations; } + (UIImage *)imageNamed:(NSString *)name; // Note, this caches the images somewhat like iPhone OS 2ish in that it never releases them. :) + (UIImage *)imageWithData:(NSData *)data; + (UIImage *)imageWithContentsOfFile:(NSString *)path; + (UIImage *)imageWithCGImage:(CGImageRef)imageRef; + (UIImage *)imageWithCGImage:(CGImageRef)imageRef scale:(CGFloat)scale orientation:(UIImageOrientation)orientation; - (id)initWithData:(NSData *)data; - (id)initWithContentsOfFile:(NSString *)path; - (id)initWithCGImage:(CGImageRef)imageRef; - (id)initWithCGImage:(CGImageRef)imageRef scale:(CGFloat)scale orientation:(UIImageOrientation)orientation; - (UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCapHeight; // the draw methods will all check the scale of the current context and attempt to use the best representation it can - (void)drawAtPoint:(CGPoint)point blendMode:(CGBlendMode)blendMode alpha:(CGFloat)alpha; - (void)drawInRect:(CGRect)rect blendMode:(CGBlendMode)blendMode alpha:(CGFloat)alpha; - (void)drawAtPoint:(CGPoint)point; - (void)drawInRect:(CGRect)rect; @property (nonatomic, readonly) CGSize size; @property (nonatomic, readonly) NSInteger leftCapWidth; @property (nonatomic, readonly) NSInteger topCapHeight; @property (nonatomic, readonly) UIImageOrientation imageOrientation; // not implemented // note that these properties return always the 2x represention if it exists! @property (nonatomic, readonly) CGImageRef CGImage; @property (nonatomic, readonly) CGFloat scale; @end void UIImageWriteToSavedPhotosAlbum(UIImage *image, id completionTarget, SEL completionSelector, void *contextInfo); void UISaveVideoAtPathToSavedPhotosAlbum(NSString *videoPath, id completionTarget, SEL completionSelector, void *contextInfo); BOOL UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(NSString *videoPath); // both of these use .CGImage to generate the image data - note what this means for multi-scale images! NSData *UIImageJPEGRepresentation(UIImage *image, CGFloat compressionQuality); NSData *UIImagePNGRepresentation(UIImage *image); ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIImage.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIImage+UIPrivate.h" #import "UIThreePartImage.h" #import "UINinePartImage.h" #import "UIGraphics.h" #import "UIPhotosAlbum.h" #import "UIImageRep.h" @implementation UIImage + (UIImage *)_imageNamed:(NSString *)name { NSBundle *bundle = [NSBundle mainBundle]; NSString *path = [[bundle resourcePath] stringByAppendingPathComponent:name]; UIImage *img = [self imageWithContentsOfFile:path]; if (!img) { // if nothing is found, try again after replacing any underscores in the name with dashes. // I don't know why, but UIKit does something similar. it probably has a good reason and it might not be this simplistic, but // for now this little hack makes Ramp Champ work. :) path = [[[bundle resourcePath] stringByAppendingPathComponent:[[name stringByDeletingPathExtension] stringByReplacingOccurrencesOfString:@"_" withString:@"-"]] stringByAppendingPathExtension:[name pathExtension]]; img = [self imageWithContentsOfFile:path]; } return img; } + (id)imageNamed:(NSString *)name { UIImage *img = [self _cachedImageForName:name]; if (!img) { // as per the iOS docs, if it fails to find a match with the bare name, it re-tries by appending a png file extension img = [self _imageNamed:name] ?: [self _imageNamed:[name stringByAppendingPathExtension:@"png"]]; [self _cacheImage:img forName:name]; } return img; } - (id)initWithContentsOfFile:(NSString *)imagePath { return [self _initWithRepresentations:[UIImageRep imageRepsWithContentsOfFile:imagePath]]; } - (id)initWithData:(NSData *)data { return [self _initWithRepresentations:[NSArray arrayWithObjects:[[[UIImageRep alloc] initWithData:data] autorelease], nil]]; } - (id)initWithCGImage:(CGImageRef)imageRef { return [self initWithCGImage:imageRef scale:1 orientation:UIImageOrientationUp]; } - (id)initWithCGImage:(CGImageRef)imageRef scale:(CGFloat)scale orientation:(UIImageOrientation)orientation { return [self _initWithRepresentations:[NSArray arrayWithObjects:[[[UIImageRep alloc] initWithCGImage:imageRef scale:scale] autorelease], nil]]; } - (void)dealloc { [_representations release]; [super dealloc]; } + (UIImage *)imageWithData:(NSData *)data { return [[[self alloc] initWithData:data] autorelease]; } + (UIImage *)imageWithContentsOfFile:(NSString *)path { return [[[self alloc] initWithContentsOfFile:path] autorelease]; } + (UIImage *)imageWithCGImage:(CGImageRef)imageRef { return [[[self alloc] initWithCGImage:imageRef] autorelease]; } + (UIImage *)imageWithCGImage:(CGImageRef)imageRef scale:(CGFloat)scale orientation:(UIImageOrientation)orientation { return [[[self alloc] initWithCGImage:imageRef scale:scale orientation:orientation] autorelease]; } - (UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCapHeight { const CGSize size = self.size; if ((leftCapWidth == 0 && topCapHeight == 0) || (leftCapWidth >= size.width && topCapHeight >= size.height)) { return self; } else if (leftCapWidth <= 0 || leftCapWidth >= size.width) { return [[[UIThreePartImage alloc] initWithRepresentations:[self _representations] capSize:MIN(topCapHeight,size.height) vertical:YES] autorelease]; } else if (topCapHeight <= 0 || topCapHeight >= size.height) { return [[[UIThreePartImage alloc] initWithRepresentations:[self _representations] capSize:MIN(leftCapWidth,size.width) vertical:NO] autorelease]; } else { return [[[UINinePartImage alloc] initWithRepresentations:[self _representations] leftCapWidth:leftCapWidth topCapHeight:topCapHeight] autorelease]; } } - (CGSize)size { CGSize size = CGSizeZero; UIImageRep *rep = [_representations lastObject]; const CGSize repSize = rep.imageSize; const CGFloat scale = rep.scale; size.width = repSize.width / scale; size.height = repSize.height / scale; return size; } - (NSInteger)leftCapWidth { return 0; } - (NSInteger)topCapHeight { return 0; } - (CGImageRef)CGImage { return [self _bestRepresentationForProposedScale:2].CGImage; } - (UIImageOrientation)imageOrientation { return UIImageOrientationUp; } - (CGFloat)scale { return [self _bestRepresentationForProposedScale:2].scale; } - (void)drawAtPoint:(CGPoint)point blendMode:(CGBlendMode)blendMode alpha:(CGFloat)alpha { [self drawInRect:(CGRect){point, self.size} blendMode:blendMode alpha:alpha]; } - (void)drawInRect:(CGRect)rect blendMode:(CGBlendMode)blendMode alpha:(CGFloat)alpha { CGContextRef ctx = UIGraphicsGetCurrentContext(); CGContextSaveGState(ctx); CGContextSetBlendMode(ctx, blendMode); CGContextSetAlpha(ctx, alpha); [self drawInRect:rect]; CGContextRestoreGState(ctx); } - (void)drawAtPoint:(CGPoint)point { [self drawInRect:(CGRect){point, self.size}]; } - (void)drawInRect:(CGRect)rect { if (rect.size.height > 0 && rect.size.width > 0) { [self _drawRepresentation:[self _bestRepresentationForProposedScale:_UIGraphicsGetContextScaleFactor(UIGraphicsGetCurrentContext())] inRect:rect]; } } @end void UIImageWriteToSavedPhotosAlbum(UIImage *image, id completionTarget, SEL completionSelector, void *contextInfo) { [[UIPhotosAlbum sharedPhotosAlbum] writeImage:image completionTarget:completionTarget action:completionSelector context:contextInfo]; } void UISaveVideoAtPathToSavedPhotosAlbum(NSString *videoPath, id completionTarget, SEL completionSelector, void *contextInfo) { } BOOL UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(NSString *videoPath) { return NO; } NSData *UIImageJPEGRepresentation(UIImage *image, CGFloat compressionQuality) { CFMutableDataRef data = CFDataCreateMutable(NULL, 0); CGImageDestinationRef dest = CGImageDestinationCreateWithData(data, kUTTypeJPEG, 1, NULL); CFNumberRef quality = CFNumberCreate(NULL, kCFNumberCGFloatType, &compressionQuality); CFStringRef keys[] = { kCGImageDestinationLossyCompressionQuality }; CFTypeRef values[] = { quality }; CFDictionaryRef properties = CFDictionaryCreate(NULL, (const void **)&keys, (const void **)&values, 1, NULL, NULL); CGImageDestinationAddImage(dest, image.CGImage, properties); CFRelease(properties); CFRelease(quality); CGImageDestinationFinalize(dest); CFRelease(dest); return [(__bridge NSData *)data autorelease]; } NSData *UIImagePNGRepresentation(UIImage *image) { CFMutableDataRef data = CFDataCreateMutable(NULL, 0); CGImageDestinationRef dest = CGImageDestinationCreateWithData(data, kUTTypePNG, 1, NULL); CGImageDestinationAddImage(dest, image.CGImage, NULL); CGImageDestinationFinalize(dest); CFRelease(dest); return [(__bridge NSData *)data autorelease]; } ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIImageAppKitIntegration.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIImage.h" @class NSImage; @interface UIImage (AppKitIntegration) + (id)imageWithNSImage:(NSImage *)theImage; - (id)initWithNSImage:(NSImage *)theImage; - (NSImage *)NSImage; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIImageAppKitIntegration.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIImage+UIPrivate.h" #import "UIImageAppKitIntegration.h" #import "UIImageRep.h" #import #import static const char *UIImageAssociatedNSImageKey = "UIImageAssociatedNSImageKey"; static UIImageRep *UIImageRepFromNSImageRep(NSImageRep *rep, NSRect rect, CGFloat scale) { return [[[UIImageRep alloc] initWithCGImage:[rep CGImageForProposedRect:&rect context:nil hints:nil] scale:scale] autorelease]; } @implementation UIImage (AppKitIntegration) + (id)imageWithNSImage:(NSImage *)theImage { return [[[self alloc] initWithNSImage:theImage] autorelease]; } - (id)initWithNSImage:(NSImage *)theImage { NSRect rect1X = NSMakeRect(0, 0, [theImage size].width, [theImage size].height); NSRect rect2X = NSMakeRect(0, 0, [theImage size].width*2, [theImage size].height*2); NSImageRep *theImageRep1X = [theImage bestRepresentationForRect:rect1X context:nil hints:nil]; NSImageRep *theImageRep2X = [theImage bestRepresentationForRect:rect2X context:nil hints:nil]; if (theImageRep1X == theImageRep2X) { theImageRep2X = nil; } UIImageRep *rep1 = UIImageRepFromNSImageRep(theImageRep1X, rect1X, 1); UIImageRep *rep2 = UIImageRepFromNSImageRep(theImageRep2X, rect2X, 2); NSMutableArray *reps = [NSMutableArray arrayWithCapacity:2]; if (rep1) [reps addObject:rep1]; if (rep2) [reps addObject:rep2]; return [self _initWithRepresentations:reps]; } - (NSImage *)NSImage { NSImage *cached = objc_getAssociatedObject(self, UIImageAssociatedNSImageKey); if (!cached) { cached = [[[NSImage alloc] initWithSize:NSSizeFromCGSize(self.size)] autorelease]; for (UIImageRep *rep in [self _representations]) { [cached addRepresentation:[[[NSBitmapImageRep alloc] initWithCGImage:rep.CGImage] autorelease]]; } objc_setAssociatedObject(self, UIImageAssociatedNSImageKey, cached, OBJC_ASSOCIATION_RETAIN); } return cached; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIImagePickerController.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UINavigationController.h" enum { UIImagePickerControllerSourceTypePhotoLibrary, UIImagePickerControllerSourceTypeCamera, UIImagePickerControllerSourceTypeSavedPhotosAlbum }; typedef NSUInteger UIImagePickerControllerSourceType; extern NSString *const UIImagePickerControllerMediaType; extern NSString *const UIImagePickerControllerOriginalImage; extern NSString *const UIImagePickerControllerEditedImage; extern NSString *const UIImagePickerControllerCropRect; extern NSString *const UIImagePickerControllerMediaURL; @protocol UIImagePickerControllerDelegate @end @interface UIImagePickerController : UINavigationController { @private UIImagePickerControllerSourceType _sourceType; NSArray *_mediaTypes; } + (NSArray *)availableMediaTypesForSourceType:(UIImagePickerControllerSourceType)sourceType; + (BOOL)isSourceTypeAvailable:(UIImagePickerControllerSourceType)sourceType; @property (nonatomic) UIImagePickerControllerSourceType sourceType; @property (nonatomic,assign) id delegate; @property (nonatomic,copy) NSArray *mediaTypes; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIImagePickerController.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIImagePickerController.h" NSString *const UIImagePickerControllerMediaType = @"UIImagePickerControllerMediaType"; NSString *const UIImagePickerControllerOriginalImage = @"UIImagePickerControllerOriginalImage"; NSString *const UIImagePickerControllerEditedImage = @"UIImagePickerControllerEditedImage"; NSString *const UIImagePickerControllerCropRect = @"UIImagePickerControllerCropRect"; NSString *const UIImagePickerControllerMediaURL = @"UIImagePickerControllerMediaURL"; @implementation UIImagePickerController @synthesize sourceType=_sourceType, mediaTypes=_mediaTypes; @dynamic delegate; + (NSArray *)availableMediaTypesForSourceType:(UIImagePickerControllerSourceType)sourceType { return nil; } + (BOOL)isSourceTypeAvailable:(UIImagePickerControllerSourceType)sourceType { return NO; } - (void)dealloc { [_mediaTypes release]; [super dealloc]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIImageRep.h ================================================ /* * Copyright (c) 2012, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @interface UIImageRep : NSObject { CGFloat _scale; CGImageSourceRef _imageSource; NSInteger _imageSourceIndex; CGImageRef _image; } + (NSArray *)imageRepsWithContentsOfFile:(NSString *)file; - (id)initWithCGImageSource:(CGImageSourceRef)source imageIndex:(NSUInteger)index scale:(CGFloat)scale; - (id)initWithCGImage:(CGImageRef)image scale:(CGFloat)scale; - (id)initWithData:(NSData *)data; // note that the cordinates for fromRect are in the image's *scaled* coordinate system, not in raw pixels // so for a 100x100px image with a scale of 2, the largest valid fromRect is of size 50x50. - (void)drawInRect:(CGRect)rect fromRect:(CGRect)fromRect; @property (nonatomic, readonly) CGSize imageSize; @property (nonatomic, readonly) CGImageRef CGImage; @property (nonatomic, readonly, getter=isLoaded) BOOL loaded; @property (nonatomic, readonly) CGFloat scale; @property (nonatomic, readonly, getter=isOpaque) BOOL opaque; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIImageRep.m ================================================ /* * Copyright (c) 2012, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIImageRep.h" #import "UIGraphics.h" static CGImageSourceRef CreateCGImageSourceWithFile(NSString *imagePath) { NSString *macPath = [[[imagePath stringByDeletingPathExtension] stringByAppendingString:@"~mac"] stringByAppendingPathExtension:[imagePath pathExtension]]; return CGImageSourceCreateWithURL((CFURLRef)[NSURL fileURLWithPath:macPath], NULL) ?: CGImageSourceCreateWithURL((CFURLRef)[NSURL fileURLWithPath:imagePath], NULL); } @implementation UIImageRep @synthesize scale=_scale; + (NSArray *)_imageRepsWithContentsOfMultiResolutionFile:(NSString *)imagePath { // Note - not currently supported, but it should be easy to add in multi-resolution TIFF support here // just check the file type initially and if it's a TIFF with multiple scale images in there, build the // representations from that and return them, otherwise return nil and +imageRepsWithContentsOfFile: will // try looking for the old-school multi-files. return nil; } + (NSArray *)_imageRepsWithContentsOfFiles:(NSString *)imagePath { NSMutableArray *reps = [NSMutableArray arrayWithCapacity:2]; CGImageSourceRef src1X = CreateCGImageSourceWithFile(imagePath); CGImageSourceRef src2X = CreateCGImageSourceWithFile([[[imagePath stringByDeletingPathExtension] stringByAppendingString:@"@2x"] stringByAppendingPathExtension:[imagePath pathExtension]]); if (src1X) { UIImageRep *rep = [[UIImageRep alloc] initWithCGImageSource:src1X imageIndex:0 scale:1]; if (rep) [reps addObject:rep]; [rep release]; CFRelease(src1X); } if (src2X) { UIImageRep *rep = [[UIImageRep alloc] initWithCGImageSource:src2X imageIndex:0 scale:2]; if (rep) [reps addObject:rep]; [rep release]; CFRelease(src2X); } return ([reps count] > 0)? reps : nil; } + (NSArray *)imageRepsWithContentsOfFile:(NSString *)imagePath { return [self _imageRepsWithContentsOfMultiResolutionFile:imagePath] ?: [self _imageRepsWithContentsOfFiles:imagePath]; } - (id)initWithCGImageSource:(CGImageSourceRef)source imageIndex:(NSUInteger)index scale:(CGFloat)scale { if (!source || CGImageSourceGetCount(source) <= index) { [self release]; self = nil; } else if ((self=[super init])) { CFRetain(source); _imageSource = source; _imageSourceIndex = index; _scale = scale; } return self; } - (id)initWithCGImage:(CGImageRef)image scale:(CGFloat)scale { if (!image) { [self release]; self = nil; } else if ((self=[super init])) { _scale = scale; _image = CGImageRetain(image); } return self; } - (id)initWithData:(NSData *)data { CGImageSourceRef src = data? CGImageSourceCreateWithData((CFDataRef)data, NULL) : NULL; if (src) { self = [self initWithCGImageSource:src imageIndex:0 scale:1]; CFRelease(src); } else { [self release]; self = nil; } return self; } - (void)dealloc { if (_image) CGImageRelease(_image); if (_imageSource) CFRelease(_imageSource); [super dealloc]; } - (BOOL)isLoaded { return (_image != NULL); } - (BOOL)isOpaque { BOOL opaque = NO; if (_image) { CGImageAlphaInfo info = CGImageGetAlphaInfo(_image); opaque = (info == kCGImageAlphaNone) || (info == kCGImageAlphaNoneSkipLast) || (info == kCGImageAlphaNoneSkipFirst); } else if (_imageSource) { CFDictionaryRef info = CGImageSourceCopyPropertiesAtIndex(_imageSource, _imageSourceIndex, NULL); opaque = CFDictionaryGetValue(info, kCGImagePropertyHasAlpha) != kCFBooleanTrue; CFRelease(info); } return opaque; } - (CGSize)imageSize { CGSize size = CGSizeZero; if (_image) { size.width = CGImageGetWidth(_image); size.height = CGImageGetHeight(_image); } else if (_imageSource) { CFDictionaryRef info = CGImageSourceCopyPropertiesAtIndex(_imageSource, _imageSourceIndex, NULL); CFNumberRef width = CFDictionaryGetValue(info, kCGImagePropertyPixelWidth); CFNumberRef height = CFDictionaryGetValue(info, kCGImagePropertyPixelHeight); if (width && height) { CFNumberGetValue(width, kCFNumberCGFloatType, &size.width); CFNumberGetValue(height, kCFNumberCGFloatType, &size.height); } CFRelease(info); } return size; } - (CGImageRef)CGImage { // lazy load if we only have an image source if (!_image && _imageSource) { _image = CGImageSourceCreateImageAtIndex(_imageSource, _imageSourceIndex, NULL); CFRelease(_imageSource); _imageSource = NULL; } return _image; } - (void)drawInRect:(CGRect)rect fromRect:(CGRect)fromRect { CGImageRef image = CGImageRetain(self.CGImage); CGContextRef ctx = UIGraphicsGetCurrentContext(); CGContextSaveGState(ctx); CGContextTranslateCTM(ctx, rect.origin.x, rect.origin.y+rect.size.height); CGContextScaleCTM(ctx, 1, -1); rect.origin = CGPointZero; if (CGRectIsNull(fromRect)) { CGContextDrawImage(ctx, rect, image); } else { fromRect.origin.x *= _scale; fromRect.origin.y *= _scale; fromRect.size.width *= _scale; fromRect.size.height *= _scale; CGImageRef tempImage = CGImageCreateWithImageInRect(image, fromRect); CGContextDrawImage(ctx, rect, tempImage); CGImageRelease(tempImage); } CGContextRestoreGState(ctx); CGImageRelease(image); } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIImageView+UIPrivate.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIImageView.h" enum { _UIImageViewDrawModeNormal, _UIImageViewDrawModeHighlighted, _UIImageViewDrawModeDisabled, }; @interface UIImageView (UIPrivate) - (void)_setDrawMode:(NSInteger)drawMode; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIImageView.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIView.h" @class UIImage, CAKeyframeAnimation; @interface UIImageView : UIView { @private UIImage *_image; NSArray *_animationImages; NSArray *_highlightedAnimationImages; NSTimeInterval _animationDuration; NSInteger _animationRepeatCount; UIImage *_highlightedImage; BOOL _highlighted; NSInteger _drawMode; } - (id)initWithImage:(UIImage *)theImage; - (void)startAnimating; - (void)stopAnimating; - (BOOL)isAnimating; @property (nonatomic, strong) UIImage *highlightedImage; @property (nonatomic, getter=isHighlighted) BOOL highlighted; @property (nonatomic, strong) UIImage *image; @property (nonatomic, copy) NSArray *animationImages; @property (nonatomic, copy) NSArray *highlightedAnimationImages; @property (nonatomic) NSTimeInterval animationDuration; @property (nonatomic) NSInteger animationRepeatCount; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIImageView.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIImageView+UIPrivate.h" #import "UIImage.h" #import "UIGraphics.h" #import "UIColor.h" #import "UIImageAppKitIntegration.h" #import "UIWindow.h" #import "UIImage+UIPrivate.h" #import "UIScreen.h" #import #import "UIImageRep.h" static NSArray *CGImagesWithUIImages(NSArray *images) { NSMutableArray *CGImages = [NSMutableArray arrayWithCapacity:[images count]]; for (UIImage *img in images) { [CGImages addObject:(__bridge id)[img CGImage]]; } return CGImages; } @implementation UIImageView @synthesize image=_image, animationImages=_animationImages, animationDuration=_animationDuration, highlightedImage=_highlightedImage, highlighted=_highlighted; @synthesize animationRepeatCount=_animationRepeatCount, highlightedAnimationImages=_highlightedAnimationImages; + (BOOL)_instanceImplementsDrawRect { return NO; } - (id)initWithFrame:(CGRect)frame { if ((self=[super initWithFrame:frame])) { _drawMode = _UIImageViewDrawModeNormal; self.userInteractionEnabled = NO; self.opaque = NO; } return self; } - (id)initWithImage:(UIImage *)theImage { CGRect frame = CGRectZero; if (theImage) { frame.size = theImage.size; } if ((self = [self initWithFrame:frame])) { self.image = theImage; } return self; } - (void)dealloc { [_animationImages release]; [_image release]; [_highlightedImage release]; [_highlightedAnimationImages release]; [super dealloc]; } - (CGSize)sizeThatFits:(CGSize)size { return _image? _image.size : CGSizeZero; } - (void)setHighlighted:(BOOL)h { if (h != _highlighted) { _highlighted = h; [self setNeedsDisplay]; if ([self isAnimating]) { [self startAnimating]; } } } - (void)setImage:(UIImage *)newImage { if (_image != newImage) { [_image release]; _image = [newImage retain]; if (!_highlighted || !_highlightedImage) { [self setNeedsDisplay]; } } } - (void)setHighlightedImage:(UIImage *)newImage { if (_highlightedImage != newImage) { [_highlightedImage release]; _highlightedImage = [newImage retain]; if (_highlighted) { [self setNeedsDisplay]; } } } - (BOOL)_hasResizableImage { return (_image.topCapHeight > 0 || _image.leftCapWidth > 0); } - (void)_setDrawMode:(NSInteger)drawMode { if (drawMode != _drawMode) { _drawMode = drawMode; [self setNeedsDisplay]; } } - (void)displayLayer:(CALayer *)theLayer { [super displayLayer:theLayer]; UIImage *displayImage = (_highlighted && _highlightedImage)? _highlightedImage : _image; const CGFloat scale = self.window.screen.scale; const CGRect bounds = self.bounds; if (displayImage && self._hasResizableImage && bounds.size.width > 0 && bounds.size.height > 0) { UIGraphicsBeginImageContextWithOptions(bounds.size, NO, scale); [displayImage drawInRect:bounds]; displayImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); } // adjust the image if required. // this will likely only ever be used UIButton, but it seemed a good place for it. // I wonder how the real UIKit does this... if (displayImage && (_drawMode != _UIImageViewDrawModeNormal)) { CGRect imageBounds; imageBounds.origin = CGPointZero; imageBounds.size = displayImage.size; UIGraphicsBeginImageContextWithOptions(imageBounds.size, NO, scale); CGBlendMode blendMode = kCGBlendModeNormal; CGFloat alpha = 1; if (_drawMode == _UIImageViewDrawModeDisabled) { alpha = 0.5; } else if (_drawMode == _UIImageViewDrawModeHighlighted) { [[[UIColor blackColor] colorWithAlphaComponent:0.4] setFill]; UIRectFill(imageBounds); blendMode = kCGBlendModeDestinationAtop; } [displayImage drawInRect:imageBounds blendMode:blendMode alpha:alpha]; displayImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); } UIImageRep *bestRepresentation = [displayImage _bestRepresentationForProposedScale:scale]; theLayer.contents = (__bridge id)bestRepresentation.CGImage; if ([theLayer respondsToSelector:@selector(setContentsScale:)]) { [theLayer setContentsScale:bestRepresentation.scale]; } } - (void)_displayIfNeededChangingFromOldSize:(CGSize)oldSize toNewSize:(CGSize)newSize { if (!CGSizeEqualToSize(newSize,oldSize) && self._hasResizableImage) { [self setNeedsDisplay]; } } - (void)setFrame:(CGRect)newFrame { [self _displayIfNeededChangingFromOldSize:self.frame.size toNewSize:newFrame.size]; [super setFrame:newFrame]; } - (void)setBounds:(CGRect)newBounds { [self _displayIfNeededChangingFromOldSize:self.bounds.size toNewSize:newBounds.size]; [super setBounds:newBounds]; } - (void)startAnimating { NSArray *images = _highlighted? _highlightedAnimationImages : _animationImages; CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"contents"]; animation.calculationMode = kCAAnimationDiscrete; animation.duration = self.animationDuration ?: ([images count] * (1/30.0)); animation.repeatCount = self.animationRepeatCount ?: HUGE_VALF; animation.values = CGImagesWithUIImages(images); animation.removedOnCompletion = NO; animation.fillMode = kCAFillModeBoth; [self.layer addAnimation:animation forKey:@"contents"]; } - (void)stopAnimating { [self.layer removeAnimationForKey:@"contents"]; } - (BOOL)isAnimating { return ([self.layer animationForKey:@"contents"] != nil); } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIInputController.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @class UIView, UIWindow; @interface UIInputController : NSObject { UIWindow *_inputWindow; UIView *_inputAccessoryView; UIView *_inputView; } + (UIInputController *)sharedInputController; - (void)setInputVisible:(BOOL)visible animated:(BOOL)animated; @property (nonatomic, strong) UIView *inputAccessoryView; @property (nonatomic, strong) UIView *inputView; @property (nonatomic, assign) BOOL inputVisible; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIInputController.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIInputController.h" #import "UIWindow+UIPrivate.h" #import "UIView+UIPrivate.h" #import "UIApplication.h" #import "UIScreen.h" static UIView *ContainerForView(UIView *view) { // find the reference view's "container" view, which I'm going to define as the nearest view of a UIViewController or a UIWindow. UIView *containerView = view; while (containerView && !([containerView isKindOfClass:[UIWindow class]] || [containerView _viewController])) { containerView = [containerView superview]; } return containerView; } @implementation UIInputController @synthesize inputAccessoryView=_inputAccessoryView, inputView=_inputView; + (UIInputController *)sharedInputController { static UIInputController *controller = nil; if (!controller) { controller = [[self alloc] init]; } return controller; } - (id)init { if ((self=[super init])) { _inputWindow = [[UIWindow alloc] initWithFrame:CGRectZero]; _inputWindow.windowLevel = UIWindowLevelStatusBar; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_viewChangedNotification:) name:UIViewFrameDidChangeNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_viewChangedNotification:) name:UIViewDidMoveToSuperviewNotification object:nil]; } return self; } - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; [_inputWindow release]; [_inputAccessoryView release]; [_inputView release]; [super dealloc]; } // finds the first real UIView that the current key window's first responder "belongs" to so we know where to display the input window - (UIView *)_referenceView { UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow; UIResponder *firstResponder = [keyWindow _firstResponder]; if (firstResponder) { UIResponder *currentResponder = firstResponder; // find the first real UIView that this responder "belongs" to so we know where to display the input view from while (currentResponder) { if ([currentResponder isKindOfClass:[UIView class]]) { return (UIView *)currentResponder; } else { currentResponder = [currentResponder nextResponder]; } } } return nil; } - (void)_repositionInputWindow { UIView *referenceView = [self _referenceView]; UIView *containerView = ContainerForView(referenceView); UIScreen *screen = containerView.window.screen; if (screen && containerView) { _inputWindow.screen = screen; const CGRect viewFrameInWindow = [referenceView convertRect:referenceView.bounds toView:nil]; const CGRect viewFrameInScreen = [referenceView.window convertRect:viewFrameInWindow toWindow:nil]; const CGRect containerFrameInWindow = [containerView convertRect:containerView.bounds toView:nil]; const CGRect containerFrameInScreen = [containerView.window convertRect:containerFrameInWindow toWindow:nil]; const CGFloat inputWidth = CGRectGetWidth(containerFrameInScreen); CGFloat inputHeight = 0; if (_inputAccessoryView) { const CGFloat height = _inputAccessoryView.frame.size.height; _inputAccessoryView.autoresizingMask = UIViewAutoresizingNone; _inputAccessoryView.frame = CGRectMake(0, inputHeight, inputWidth, height); inputHeight += height; } if (_inputView) { const CGFloat height = _inputView.frame.size.height; _inputView.autoresizingMask = UIViewAutoresizingNone; _inputView.frame = CGRectMake(0, inputHeight, inputWidth, height); inputHeight += height; } _inputWindow.frame = CGRectMake(CGRectGetMinX(containerFrameInScreen), CGRectGetMaxY(viewFrameInScreen), inputWidth, inputHeight); } } - (void)_viewChangedNotification:(NSNotification *)note { UIView *view = [note object]; UIView *referenceView = [self _referenceView]; if (self.inputVisible && (view == referenceView || [ContainerForView(referenceView) isDescendantOfView:view])) { [self _repositionInputWindow]; } } - (void)setInputVisible:(BOOL)visible animated:(BOOL)animated { [self _repositionInputWindow]; NSDictionary *fakeAnimationInfo = [NSDictionary dictionaryWithObjectsAndKeys: [NSValue valueWithCGRect:_inputWindow.frame], UIKeyboardFrameBeginUserInfoKey, [NSValue valueWithCGRect:_inputWindow.frame], UIKeyboardFrameEndUserInfoKey, [NSNumber numberWithDouble:0], UIKeyboardAnimationDurationUserInfoKey, [NSNumber numberWithInt:UIViewAnimationCurveLinear], UIKeyboardAnimationCurveUserInfoKey, nil]; if (visible) { [[NSNotificationCenter defaultCenter] postNotificationName:UIKeyboardWillShowNotification object:nil userInfo:fakeAnimationInfo]; } else { [[NSNotificationCenter defaultCenter] postNotificationName:UIKeyboardWillHideNotification object:nil userInfo:fakeAnimationInfo]; } _inputWindow.hidden = !visible; if (visible) { [[NSNotificationCenter defaultCenter] postNotificationName:UIKeyboardDidShowNotification object:nil userInfo:fakeAnimationInfo]; } else { [[NSNotificationCenter defaultCenter] postNotificationName:UIKeyboardDidHideNotification object:nil userInfo:fakeAnimationInfo]; } } - (void)setInputVisible:(BOOL)inputVisible { [self setInputVisible:inputVisible animated:NO]; } - (BOOL)inputVisible { return !_inputWindow.hidden; } - (void)setInputAccessoryView:(UIView *)view { if (view != _inputAccessoryView) { [_inputAccessoryView removeFromSuperview]; [_inputAccessoryView release]; _inputAccessoryView = [view retain]; [_inputWindow addSubview:_inputAccessoryView]; } } - (void)setInputView:(UIView *)view { if (view != _inputView) { [_inputView removeFromSuperview]; [_inputView release]; _inputView = [view retain]; [_inputWindow addSubview:_inputView]; } } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIInterface.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIColor.h" #import "UIFont.h" typedef enum { UIBarStyleDefault = 0, UIBarStyleBlack = 1, UIBarStyleBlackOpaque = 1, // Deprecated UIBarStyleBlackTranslucent = 2 // Deprecated } UIBarStyle; @interface UIColor (UIColorSystemColors) + (UIColor *)groupTableViewBackgroundColor; @end @interface UIFont (UIFontSystemFonts) + (CGFloat)systemFontSize; + (CGFloat)smallSystemFontSize; + (CGFloat)labelFontSize; + (CGFloat)buttonFontSize; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIInterface.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIInterface.h" #import @implementation UIColor (UIColorSystemColors) + (UIColor *)groupTableViewBackgroundColor { return [UIColor lightGrayColor]; // this is currently not likely to be correct, please fix! } @end @implementation UIFont (UIFontSystemFonts) + (CGFloat)systemFontSize { return [NSFont systemFontSize]; } + (CGFloat)smallSystemFontSize { return [NSFont smallSystemFontSize]; } + (CGFloat)labelFontSize { return [NSFont labelFontSize]; } + (CGFloat)buttonFontSize { return [NSFont systemFontSizeForControlSize:NSRegularControlSize]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIKey+UIPrivate.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIKey.h" @class NSEvent; @interface UIKey (UIPrivate) - (id)initWithNSEvent:(NSEvent *)event; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIKey.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import // NOTE: This does not come from Apple's UIKit and only exist to solve some current problems. // I have no idea what Apple will do with keyboard handling. If they ever expose that stuff publically, // then all of this should change to reflect the official API. typedef enum { UIKeyTypeCharacter, // the catch-all/default... I wouldn't depend much on this at this point UIKeyTypeUpArrow, UIKeyTypeDownArrow, UIKeyTypeLeftArrow, UIKeyTypeRightArrow, UIKeyTypeReturn, UIKeyTypeEnter, UIKeyTypeHome, UIKeyTypeInsert, UIKeyTypeDelete, UIKeyTypeEnd, UIKeyTypePageUp, UIKeyTypePageDown, } UIKeyType; @interface UIKey : NSObject { @private unsigned short _keyCode; NSString *_characters; NSString *_charactersWithModifiers; NSUInteger _modifierFlags; BOOL _repeat; } @property (nonatomic, readonly) UIKeyType type; @property (nonatomic, readonly) unsigned short keyCode; @property (nonatomic, readonly) NSString *characters; @property (nonatomic, readonly) NSString *charactersWithModifiers; @property (nonatomic, readonly, getter=isRepeat) BOOL repeat; @property (nonatomic, readonly, getter=isCapslockEnabled) BOOL capslockEnabled; @property (nonatomic, readonly, getter=isShiftKeyPressed) BOOL shiftKeyPressed; @property (nonatomic, readonly, getter=isControlKeyPressed) BOOL controlKeyPressed; @property (nonatomic, readonly, getter=isOptionKeyPressed) BOOL optionKeyPressed; @property (nonatomic, readonly, getter=isCommandKeyPressed) BOOL commandKeyPressed; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIKey.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIKey+UIPrivate.h" #import @implementation UIKey @synthesize keyCode=_keyCode, characters=_characters, charactersWithModifiers=_charactersWithModifiers, repeat=_repeat; - (id)initWithNSEvent:(NSEvent *)event { if ((self=[super init])) { _keyCode = [event keyCode]; _characters = [[event charactersIgnoringModifiers] copy]; _charactersWithModifiers = [[event characters] copy]; _repeat = [event isARepeat]; _modifierFlags = [event modifierFlags]; } return self; } - (void)dealloc { [_characters release]; [_charactersWithModifiers release]; [super dealloc]; } - (UIKeyType)type { if ([_characters length] > 0) { switch ([_characters characterAtIndex:0]) { case NSUpArrowFunctionKey: return UIKeyTypeUpArrow; case NSDownArrowFunctionKey: return UIKeyTypeDownArrow; case NSLeftArrowFunctionKey: return UIKeyTypeLeftArrow; case NSRightArrowFunctionKey: return UIKeyTypeRightArrow; case NSEndFunctionKey: return UIKeyTypeEnd; case NSPageUpFunctionKey: return UIKeyTypePageUp; case NSPageDownFunctionKey: return UIKeyTypePageDown; case NSDeleteFunctionKey: return UIKeyTypeDelete; case NSInsertFunctionKey: return UIKeyTypeInsert; case NSHomeFunctionKey: return UIKeyTypeHome; case 0x000D: return UIKeyTypeReturn; case 0x0003: return UIKeyTypeEnter; } } return UIKeyTypeCharacter; } - (BOOL)isCapslockEnabled { return (_modifierFlags & NSAlphaShiftKeyMask) == NSAlphaShiftKeyMask; } - (BOOL)isShiftKeyPressed { return (_modifierFlags & NSShiftKeyMask) == NSShiftKeyMask; } - (BOOL)isControlKeyPressed { return (_modifierFlags & NSControlKeyMask) == NSControlKeyMask; } - (BOOL)isOptionKeyPressed { return (_modifierFlags & NSAlternateKeyMask) == NSAlternateKeyMask; } - (BOOL)isCommandKeyPressed { return (_modifierFlags & NSCommandKeyMask) == NSCommandKeyMask; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIKit.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef IBAction #define IBAction void #endif #ifndef IBOutlet #define IBOutlet #endif #import "UIApplicationDelegate.h" #import "UIScreen.h" #import "UIGeometry.h" #import "UIGraphics.h" #import "UIEvent.h" #import "UIResponder.h" #import "UIImage.h" #import "UIColor.h" #import "UIView.h" #import "UIWindow.h" #import "UITouch.h" #import "UIApplication.h" #import "UIInterface.h" #import "UIImageView.h" #import "UIScrollView.h" #import "UITableView.h" #import "UITableViewCell.h" #import "UIFont.h" #import "UILabel.h" #import "UIStringDrawing.h" #import "UIDevice.h" #import "UIAccessibility.h" #import "UIAccessibilityElement.h" #import "UIControl.h" #import "UIButton.h" #import "UIBezierPath.h" #import "UIViewController.h" #import "UIScreenMode.h" #import "UIActionSheet.h" #import "UIAlertView.h" #import "UITextField.h" #import "UINavigationItem.h" #import "UINavigationController.h" #import "UIBarItem.h" #import "UIBarButtonItem.h" #import "UIPasteboard.h" #import "UITextInputTraits.h" #import "UIWebView.h" #import "UIToolbar.h" #import "UITabBar.h" #import "UITabBarItem.h" #import "UISegmentedControl.h" #import "UIActivityIndicatorView.h" #import "UIPopoverController.h" #import "UINavigationBar.h" #import "UITextView.h" #import "UIDataDetectors.h" #import "UITableViewController.h" #import "UISearchBar.h" #import "UISearchDisplayController.h" #import "UIImagePickerController.h" #import "UINibLoading.h" #import "UIGestureRecognizer.h" #import "UITapGestureRecognizer.h" #import "UILongPressGestureRecognizer.h" #import "UISplitViewController.h" #import "UITabBarController.h" #import "UISwitch.h" #import "UISlider.h" #import "UIAcceleration.h" #import "UIAccelerometer.h" #import "UIMenuController.h" #import "UIMenuItem.h" #import "UIViewAdapter.h" #import "UIPageControl.h" #import "UIProgressView.h" #import "UIPickerView.h" #import "UIPanGestureRecognizer.h" #import "UIPinchGestureRecognizer.h" #import "UIRotationGestureRecognizer.h" #import "UISwipeGestureRecognizer.h" #import "UIDatePicker.h" #import "UIAppearance.h" // non-standard imports #import "UIKey.h" #import "UIScrollWheelGestureRecognizer.h" // SystemConfiguration-Helper #define kSCNetworkReachabilityFlagsIsWWAN kSCNetworkReachabilityFlagsConnectionOnDemand ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIKitView.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import #import "UIApplicationDelegate.h" @class UIScreen, UIWindow; @interface UIKitView : NSView { UIScreen *_screen; UIWindow *_mainWindow; NSTrackingArea *_trackingArea; } // if UIApplication's keyWindow is on the screen represented by this UIKitView, this will send -canPerformAction:withSender: to the keyWindow's // current first responder with the given action and sender and return the result. if the keyWindow is not on this screen, it always returns NO. - (BOOL)firstResponderCanPerformAction:(SEL)action withSender:(id)sender; // if UIApplication's keyWindow is on the screen represented by this UIKitView, this will send the action down the responder chain starting with // the keyWindow's first responder. if the keyWindow is not on this screen, nothing happens. - (void)sendActionToFirstResponder:(SEL)action from:(id)sender; // this is an optional method // it will set the sharedApplication's delegate to appDelegate. if delay is >0, it will then look in the app bundle for // various default.png images (ideally it would replicate the search pattern that the iPad does, but for now it's just // uses Default-Landscape.png). If delay <= 0, it skips doing any launch stuff and just calls the delegate's // applicationDidFinishLaunching: method. It's up to the app delegate to create its own window, just as it is in the real // UIKit when not using a XIB. // ** IMPORTANT: appDelegate is *not* retained! ** - (void)launchApplicationWithDelegate:(id)appDelegate afterDelay:(NSTimeInterval)delay; // this is an optional property to make it quick and easy to get a window to start adding views to. // created on-demand to be the size of the UIScreen.bounds, flexible width/height, and calls makeKeyAndVisible when it is first created @property (nonatomic, retain, readonly) UIWindow *UIWindow; // a UIKitView owns a single UIScreen. when the UIKitView is part of an NSWindow hierarchy, the UIScreen appears as a connected screen in // [UIScreen screens], etc. @property (nonatomic, retain, readonly) UIScreen *UIScreen; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIKitView.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIKitView.h" #import "UIApplication+UIPrivate.h" #import "UIScreen+UIPrivate.h" #import "UIWindow+UIPrivate.h" #import "UIImage.h" #import "UIImageView.h" #import "UIColor.h" @implementation UIKitView @synthesize UIScreen=_screen; - (void)setScreenLayer { [self setWantsLayer:YES]; CALayer *screenLayer = [_screen _layer]; CALayer *myLayer = [self layer]; [myLayer addSublayer:screenLayer]; screenLayer.frame = myLayer.bounds; screenLayer.autoresizingMask = kCALayerWidthSizable | kCALayerHeightSizable; myLayer.geometryFlipped = YES; } - (id)initWithFrame:(NSRect)frame { if ((self = [super initWithFrame:frame])) { _screen = [[UIScreen alloc] init]; [self setScreenLayer]; } return self; } - (void)dealloc { [_screen release]; [_mainWindow release]; [_trackingArea release]; [super dealloc]; } - (void)awakeFromNib { [self setScreenLayer]; } - (UIWindow *)UIWindow { if (!_mainWindow) { _mainWindow = [(UIWindow *)[UIWindow alloc] initWithFrame:_screen.bounds]; _mainWindow.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; _mainWindow.screen = _screen; [_mainWindow makeKeyAndVisible]; } return _mainWindow; } - (BOOL)isFlipped { return YES; } - (void)updateUIKitView { [_screen _setUIKitView:(self.superview && self.window)? self : nil]; } - (void)viewDidMoveToSuperview { [super viewDidMoveToSuperview]; [self updateUIKitView]; } - (void)viewDidMoveToWindow { [super viewDidMoveToWindow]; [self updateUIKitView]; } - (BOOL)acceptsFirstResponder { // only accept first responder status if something else within our view isn't already the first responder // and if our screen has something that can become first responder // I have no idea if this is sane behavior or not. There's an issue with things like inputAccesoryViews // because the NSTextView might be the real first responder (from AppKit's point of view) and any click // outside of it could change the first responder status. This means that clicks on the inputAccessoryView // could "steal" first responder away from the NSTextView if this always returns YES, but on the other // hand we shouldn't always return NO here because pure-UIKit objects could be first responder, too, and // in theory they'd expect to get keyboard events or something like that. So....... yeah.. I dunno. NSResponder *responder = [(NSWindow *)[self window] firstResponder]; BOOL accept = !responder || ([[UIApplication sharedApplication] _firstResponderForScreen:_screen] != nil); // if we might want to accept, lets make sure that one of our children isn't already the first responder // because we don't want to let the mouse just steal that away here. If a pure-UIKit object gets clicked on and // decides to become first responder, it'll take it itself and things should sort itself out from there // (so stuff like a selected NSTextView would be resigned in the process of the new object becoming first // responder so we don't have to let AppKit handle it in that case and returning NO here should be okay) if (accept) { while (responder) { if (responder == self) { return NO; } else { responder = [responder nextResponder]; } } } return accept; } - (BOOL)firstResponderCanPerformAction:(SEL)action withSender:(id)sender { return [[UIApplication sharedApplication] _firstResponderCanPerformAction:action withSender:sender fromScreen:_screen]; } - (void)sendActionToFirstResponder:(SEL)action from:(id)sender { [[UIApplication sharedApplication] _sendActionToFirstResponder:action withSender:sender fromScreen:_screen]; } - (BOOL)respondsToSelector:(SEL)cmd { if (cmd == @selector(copy:) || cmd == @selector(cut:) || cmd == @selector(delete:) || cmd == @selector(paste:) || cmd == @selector(select:) || cmd == @selector(selectAll:) || cmd == @selector(commit:) || cmd == @selector(cancel:)) { return [self firstResponderCanPerformAction:cmd withSender:nil]; } else if (cmd == @selector(cancelOperation:)) { return [self firstResponderCanPerformAction:@selector(cancel:) withSender:nil]; } else { return [super respondsToSelector:cmd]; } } - (void)copy:(id)sender { [self sendActionToFirstResponder:_cmd from:sender]; } - (void)cut:(id)sender { [self sendActionToFirstResponder:_cmd from:sender]; } - (void)delete:(id)sender { [self sendActionToFirstResponder:_cmd from:sender]; } - (void)paste:(id)sender { [self sendActionToFirstResponder:_cmd from:sender]; } - (void)select:(id)sender { [self sendActionToFirstResponder:_cmd from:sender]; } - (void)selectAll:(id)sender { [self sendActionToFirstResponder:_cmd from:sender]; } // these are special additions - (void)cancel:(id)sender { [self sendActionToFirstResponder:_cmd from:sender]; } - (void)commit:(id)sender { [self sendActionToFirstResponder:_cmd from:sender]; } // this is a special case, UIKit doesn't normally send anything like this. // if a UIKit first responder can't handle it, then we'll pass it through to the next responder // because something else might want to deal with it somewhere else. - (void)cancelOperation:(id)sender { [self sendActionToFirstResponder:@selector(cancel:) from:sender]; } // capture the key presses here and turn them into key events which are sent down the UIKit responder chain // if they come back as unhandled, pass them along the AppKit responder chain. - (void)keyDown:(NSEvent *)theEvent { if (![[UIApplication sharedApplication] _sendKeyboardNSEvent:theEvent fromScreen:_screen]) { [super keyDown:theEvent]; } } - (void)updateTrackingAreas { [super updateTrackingAreas]; [self removeTrackingArea:_trackingArea]; [_trackingArea release]; _trackingArea = [[NSTrackingArea alloc] initWithRect:self.bounds options:NSTrackingCursorUpdate|NSTrackingMouseMoved|NSTrackingInVisibleRect|NSTrackingActiveInKeyWindow|NSTrackingMouseEnteredAndExited owner:self userInfo:nil]; [self addTrackingArea:_trackingArea]; } - (void)mouseMoved:(NSEvent *)theEvent { [[UIApplication sharedApplication] _sendMouseNSEvent:theEvent fromScreen:_screen]; } - (void)mouseDown:(NSEvent *)theEvent { if ([theEvent modifierFlags] & NSControlKeyMask) { // I don't really like this, but it seemed to be necessary. // If I override the menuForEvent: method, when you control-click it *still* sends mouseDown:, so I don't // really win anything by overriding that since I'd still need a check in here to prevent that mouseDown: from being // sent to UIKit as a touch. That seems really wrong, IMO. A right click should be independent of a touch event. // soooo.... here we are. Whatever. Seems to work. Don't really like it. NSEvent *newEvent = [NSEvent mouseEventWithType:NSRightMouseDown location:[theEvent locationInWindow] modifierFlags:0 timestamp:[theEvent timestamp] windowNumber:[theEvent windowNumber] context:[theEvent context] eventNumber:[theEvent eventNumber] clickCount:[theEvent clickCount] pressure:[theEvent pressure]]; [self rightMouseDown:newEvent]; } else { [[UIApplication sharedApplication] _sendMouseNSEvent:theEvent fromScreen:_screen]; } } - (void)mouseUp:(NSEvent *)theEvent { [[UIApplication sharedApplication] _sendMouseNSEvent:theEvent fromScreen:_screen]; } - (void)mouseDragged:(NSEvent *)theEvent { [[UIApplication sharedApplication] _sendMouseNSEvent:theEvent fromScreen:_screen]; } - (void)rightMouseDown:(NSEvent *)theEvent { [[UIApplication sharedApplication] _sendMouseNSEvent:theEvent fromScreen:_screen]; } - (void)scrollWheel:(NSEvent *)theEvent { [[UIApplication sharedApplication] _sendMouseNSEvent:theEvent fromScreen:_screen]; } - (void)mouseEntered:(NSEvent *)theEvent { [[UIApplication sharedApplication] _sendMouseNSEvent:theEvent fromScreen:_screen]; } - (void)mouseExited:(NSEvent *)theEvent { [[UIApplication sharedApplication] _sendMouseNSEvent:theEvent fromScreen:_screen]; } - (void)beginGestureWithEvent:(NSEvent *)theEvent { [[UIApplication sharedApplication] _sendMouseNSEvent:theEvent fromScreen:_screen]; } - (void)endGestureWithEvent:(NSEvent *)theEvent { [[UIApplication sharedApplication] _sendMouseNSEvent:theEvent fromScreen:_screen]; } - (void)rotateWithEvent:(NSEvent *)theEvent { [[UIApplication sharedApplication] _sendMouseNSEvent:theEvent fromScreen:_screen]; } - (void)magnifyWithEvent:(NSEvent *)theEvent { [[UIApplication sharedApplication] _sendMouseNSEvent:theEvent fromScreen:_screen]; } - (void)swipeWithEvent:(NSEvent *)theEvent { [[UIApplication sharedApplication] _sendMouseNSEvent:theEvent fromScreen:_screen]; } - (void)_launchApplicationWithDefaultWindow:(UIWindow *)defaultWindow { UIApplication *app = [UIApplication sharedApplication]; id appDelegate = app.delegate; if ([appDelegate respondsToSelector:@selector(application:didFinishLaunchingWithOptions:)]) { [appDelegate application:app didFinishLaunchingWithOptions:nil]; } else if ([appDelegate respondsToSelector:@selector(applicationDidFinishLaunching:)]) { [appDelegate applicationDidFinishLaunching:app]; } [[NSNotificationCenter defaultCenter] postNotificationName:UIApplicationDidFinishLaunchingNotification object:app]; if ([appDelegate respondsToSelector:@selector(applicationDidBecomeActive:)]) { [appDelegate applicationDidBecomeActive:app]; } [[NSNotificationCenter defaultCenter] postNotificationName:UIApplicationDidBecomeActiveNotification object:app]; defaultWindow.hidden = YES; } - (void)launchApplicationWithDelegate:(id)appDelegate afterDelay:(NSTimeInterval)delay { [[UIApplication sharedApplication] setDelegate:appDelegate]; if (delay) { UIImage *defaultImage = [UIImage imageNamed:@"Default-Landscape.png"]; UIImageView *defaultImageView = [[[UIImageView alloc] initWithImage:defaultImage] autorelease]; defaultImageView.contentMode = UIViewContentModeCenter; UIWindow *defaultWindow = [(UIWindow *)[UIWindow alloc] initWithFrame:_screen.bounds]; defaultWindow.userInteractionEnabled = NO; defaultWindow.screen = _screen; defaultWindow.backgroundColor = [UIColor blackColor]; // dunno.. defaultWindow.opaque = YES; [defaultWindow addSubview:defaultImageView]; [defaultWindow makeKeyAndVisible]; [self performSelector:@selector(_launchApplicationWithDefaultWindow:) withObject:defaultWindow afterDelay:delay]; [defaultWindow release]; } else { [self _launchApplicationWithDefaultWindow:nil]; } } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UILabel.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIView.h" #import "UIStringDrawing.h" @class UIFont, UIColor; @interface UILabel : UIView { @private NSString *_text; UIFont *_font; UIColor *_textColor; UIColor *_highlightedTextColor; UIColor *_shadowColor; CGSize _shadowOffset; UITextAlignment _textAlignment; UILineBreakMode _lineBreakMode; BOOL _enabled; NSInteger _numberOfLines; UIBaselineAdjustment _baselineAdjustment; BOOL _adjustsFontSizeToFitWidth; CGFloat _minimumFontSize; BOOL _highlighted; } @property (nonatomic, copy) NSString *text; @property (nonatomic, strong) UIFont *font; @property (nonatomic, strong) UIColor *textColor; @property (nonatomic, strong) UIColor *highlightedTextColor; @property (nonatomic, strong) UIColor *shadowColor; @property (nonatomic) CGSize shadowOffset; @property (nonatomic) UITextAlignment textAlignment; @property (nonatomic) UILineBreakMode lineBreakMode; @property (nonatomic, getter=isEnabled) BOOL enabled; @property (nonatomic) NSInteger numberOfLines; // currently only supports 0 or 1 @property (nonatomic) UIBaselineAdjustment baselineAdjustment; // not implemented @property (nonatomic) BOOL adjustsFontSizeToFitWidth; // not implemented @property (nonatomic) CGFloat minimumFontSize; // not implemented @property (nonatomic, getter=isHighlighted) BOOL highlighted; - (CGRect)textRectForBounds:(CGRect)bounds limitedToNumberOfLines:(NSInteger)numberOfLines; - (void)drawTextInRect:(CGRect)rect; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UILabel.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UILabel.h" #import "UIColor.h" #import "UIFont.h" #import "UIGraphics.h" #import @implementation UILabel @synthesize text=_text, font=_font, textColor=_textColor, textAlignment=_textAlignment, lineBreakMode=_lineBreakMode, enabled=_enabled; @synthesize numberOfLines=_numberOfLines, shadowColor=_shadowColor, shadowOffset=_shadowOffset; @synthesize baselineAdjustment=_baselineAdjustment, adjustsFontSizeToFitWidth=_adjustsFontSizeToFitWidth; @synthesize highlightedTextColor=_highlightedTextColor, minimumFontSize=_minimumFontSize, highlighted=_highlighted; - (id)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { self.userInteractionEnabled = NO; self.textAlignment = UITextAlignmentLeft; self.lineBreakMode = UILineBreakModeTailTruncation; self.textColor = [UIColor blackColor]; self.backgroundColor = [UIColor whiteColor]; self.enabled = YES; self.font = [UIFont systemFontOfSize:17]; self.numberOfLines = 1; self.contentMode = UIViewContentModeLeft; self.clipsToBounds = YES; self.shadowOffset = CGSizeMake(0,-1); self.baselineAdjustment = UIBaselineAdjustmentAlignBaselines; } return self; } - (void)dealloc { [_text release]; [_font release]; [_textColor release]; [_shadowColor release]; [_highlightedTextColor release]; [super dealloc]; } - (void)setText:(NSString *)newText { if (_text != newText) { [_text release]; _text = [newText copy]; [self setNeedsDisplay]; } } - (void)setFont:(UIFont *)newFont { assert(newFont != nil); if (newFont != _font) { [_font release]; _font = [newFont retain]; [self setNeedsDisplay]; } } - (void)setTextColor:(UIColor *)newColor { if (newColor != _textColor) { [_textColor release]; _textColor = [newColor retain]; [self setNeedsDisplay]; } } - (void)setShadowColor:(UIColor *)newColor { if (newColor != _shadowColor) { [_shadowColor release]; _shadowColor = [newColor retain]; [self setNeedsDisplay]; } } - (void)setShadowOffset:(CGSize)newOffset { if (!CGSizeEqualToSize(newOffset,_shadowOffset)) { _shadowOffset = newOffset; [self setNeedsDisplay]; } } - (void)setTextAlignment:(UITextAlignment)newAlignment { if (newAlignment != _textAlignment) { _textAlignment = newAlignment; [self setNeedsDisplay]; } } - (void)setLineBreakMode:(UILineBreakMode)newMode { if (newMode != _lineBreakMode) { _lineBreakMode = newMode; [self setNeedsDisplay]; } } - (void)setEnabled:(BOOL)newEnabled { if (newEnabled != _enabled) { _enabled = newEnabled; [self setNeedsDisplay]; } } - (void)setNumberOfLines:(NSInteger)lines { if (lines != _numberOfLines) { _numberOfLines = lines; [self setNeedsDisplay]; } } - (CGRect)textRectForBounds:(CGRect)bounds limitedToNumberOfLines:(NSInteger)numberOfLines { if ([_text length] > 0) { CGSize maxSize = bounds.size; if (numberOfLines > 0) { maxSize.height = _font.lineHeight * numberOfLines; } CGSize size = [_text sizeWithFont: _font constrainedToSize: maxSize lineBreakMode: _lineBreakMode]; return (CGRect){bounds.origin, size}; } return (CGRect){bounds.origin, {0, 0}}; } - (void)drawTextInRect:(CGRect)rect { [_text drawInRect:rect withFont:_font lineBreakMode:_lineBreakMode alignment:_textAlignment]; } - (void)drawRect:(CGRect)rect { if ([_text length] > 0) { CGContextSaveGState(UIGraphicsGetCurrentContext()); const CGRect bounds = self.bounds; CGRect drawRect = CGRectZero; // find out the actual size of the text given the size of our bounds CGSize maxSize = bounds.size; if (_numberOfLines > 0) { maxSize.height = _font.lineHeight * _numberOfLines; } drawRect.size = [_text sizeWithFont:_font constrainedToSize:maxSize lineBreakMode:_lineBreakMode]; // now vertically center it drawRect.origin.y = roundf((bounds.size.height - drawRect.size.height) / 2.f); // now position it correctly for the width // this might be cheating somehow and not how the real thing does it... // I didn't spend a ton of time investigating the sizes that it sends the drawTextInRect: method drawRect.origin.x = 0; drawRect.size.width = bounds.size.width; // if there's a shadow, let's set that up CGSize offset = _shadowOffset; // stupid version compatibilities.. if (floorf(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_6) { offset.height *= -1; } CGContextSetShadowWithColor(UIGraphicsGetCurrentContext(), offset, 0, _shadowColor.CGColor); // finally, draw the real label UIColor *drawColor = (_highlighted && _highlightedTextColor)? _highlightedTextColor : _textColor; [drawColor setFill]; [self drawTextInRect:drawRect]; CGContextRestoreGState(UIGraphicsGetCurrentContext()); } } - (void)setFrame:(CGRect)newFrame { const BOOL redisplay = !CGSizeEqualToSize(newFrame.size,self.frame.size); [super setFrame:newFrame]; if (redisplay) { [self setNeedsDisplay]; } } - (CGSize)sizeThatFits:(CGSize)size { size = CGSizeMake(((_numberOfLines > 0)? CGFLOAT_MAX : size.width), ((_numberOfLines <= 0)? CGFLOAT_MAX : (_font.lineHeight*_numberOfLines))); return [_text sizeWithFont:_font constrainedToSize:size lineBreakMode:_lineBreakMode]; } - (void)setHighlighted:(BOOL)highlighted { if (highlighted != _highlighted) { _highlighted = highlighted; [self setNeedsDisplay]; } } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UILongPressGestureRecognizer.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIGestureRecognizer.h" // This will work for normal left-click long presses OR a right-click. The right-click will always // be recognized as a long press regardless of how long the user holds down the right mouse button // and it doesn't worry about allowableMovement and the other parameters that the regular long // press would normally need to be worried about. @interface UILongPressGestureRecognizer : UIGestureRecognizer { @private CFTimeInterval _minimumPressDuration; CGFloat _allowableMovement; NSUInteger _numberOfTapsRequired; NSInteger _numberOfTouchesRequired; CGPoint _beginLocation; BOOL _waiting; } @property (nonatomic) CFTimeInterval minimumPressDuration; @property (nonatomic) CGFloat allowableMovement; @property (nonatomic) NSUInteger numberOfTapsRequired; @property (nonatomic) NSInteger numberOfTouchesRequired; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UILongPressGestureRecognizer.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UILongPressGestureRecognizer.h" #import "UIGestureRecognizerSubclass.h" #import "UITouch+UIPrivate.h" #import "UIEvent.h" static CGFloat DistanceBetweenTwoPoints(CGPoint A, CGPoint B) { CGFloat a = B.x - A.x; CGFloat b = B.y - A.y; return sqrtf((a*a) + (b*b)); } @implementation UILongPressGestureRecognizer @synthesize minimumPressDuration=_minimumPressDuration, allowableMovement=_allowableMovement, numberOfTapsRequired=_numberOfTapsRequired; @synthesize numberOfTouchesRequired=_numberOfTouchesRequired; - (id)initWithTarget:(id)target action:(SEL)action { if ((self=[super initWithTarget:target action:action])) { _allowableMovement = 10; _minimumPressDuration = 0.5; _numberOfTapsRequired = 0; _numberOfTouchesRequired = 1; } return self; } - (void)_discreteGestures:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [[event touchesForGestureRecognizer:self] anyObject]; if (self.state == UIGestureRecognizerStatePossible && [touch _gesture] == _UITouchDiscreteGestureRightClick) { self.state = UIGestureRecognizerStateBegan; [self performSelector:@selector(_endFakeContinuousGesture) withObject:nil afterDelay:0]; } } - (void)_endFakeContinuousGesture { if (self.state == UIGestureRecognizerStateBegan || self.state == UIGestureRecognizerStateChanged) { self.state = UIGestureRecognizerStateEnded; } } - (void)_beginGesture { _waiting = NO; if (self.state == UIGestureRecognizerStatePossible) { self.state = UIGestureRecognizerStateBegan; } } - (void)_cancelWaiting { if (_waiting) { _waiting = NO; [[self class] cancelPreviousPerformRequestsWithTarget:self selector:@selector(_beginGesture) object:nil]; } } - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [[event touchesForGestureRecognizer:self] anyObject]; if (!_waiting && self.state == UIGestureRecognizerStatePossible && touch.tapCount >= self.numberOfTapsRequired) { _beginLocation = [touch locationInView:self.view]; _waiting = YES; [self performSelector:@selector(_beginGesture) withObject:nil afterDelay:self.minimumPressDuration]; } } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { if (self.state == UIGestureRecognizerStateBegan || self.state == UIGestureRecognizerStateChanged) { UITouch *touch = [[event touchesForGestureRecognizer:self] anyObject]; const CGFloat distance = DistanceBetweenTwoPoints([touch locationInView:self.view], _beginLocation); if (distance <= self.allowableMovement) { self.state = UIGestureRecognizerStateChanged; } else { self.state = UIGestureRecognizerStateCancelled; } } } - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { if (self.state == UIGestureRecognizerStateBegan || self.state == UIGestureRecognizerStateChanged) { self.state = UIGestureRecognizerStateEnded; } else { [self _cancelWaiting]; } } - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { if (self.state == UIGestureRecognizerStateBegan || self.state == UIGestureRecognizerStateChanged) { self.state = UIGestureRecognizerStateCancelled; } else { [self _cancelWaiting]; } } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIMenuController.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import extern NSString *const UIMenuControllerWillShowMenuNotification; extern NSString *const UIMenuControllerDidShowMenuNotification; extern NSString *const UIMenuControllerWillHideMenuNotification; extern NSString *const UIMenuControllerDidHideMenuNotification; extern NSString *const UIMenuControllerMenuFrameDidChangeNotification; @class UIView, UIWindow; @interface UIMenuController : NSObject { @private NSArray *_menuItems; NSMutableArray *_enabledMenuItems; id _menu; CGRect _menuFrame; CGPoint _menuLocation; BOOL _rightAlignMenu; UIWindow *_window; } + (UIMenuController *)sharedMenuController; - (void)setMenuVisible:(BOOL)menuVisible animated:(BOOL)animated; - (void)setTargetRect:(CGRect)targetRect inView:(UIView *)targetView; // if targetRect is CGRectNull, the menu will appear wherever the mouse cursor was at the time this method was called - (void)update; @property (nonatomic, getter=isMenuVisible) BOOL menuVisible; @property (copy) NSArray *menuItems; // returned in screen coords of the screen that the view used in setTargetRect:inView: belongs to // there's always a value here, but it's not likely to be terribly reliable except immidately after // the menu is made visible. I have no intenstively tested what the real UIKit does in all the possible // situations. You have been warned. @property (nonatomic, readonly) CGRect menuFrame; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIMenuController.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIMenuController.h" #import "UIApplication+UIPrivate.h" #import "UIWindow+UIPrivate.h" #import "UIScreenAppKitIntegration.h" #import "UIKitView.h" #import "UIMenuItem.h" #import #import #import NSString *const UIMenuControllerWillShowMenuNotification = @"UIMenuControllerWillShowMenuNotification"; NSString *const UIMenuControllerDidShowMenuNotification = @"UIMenuControllerDidShowMenuNotification"; NSString *const UIMenuControllerWillHideMenuNotification = @"UIMenuControllerWillHideMenuNotification"; NSString *const UIMenuControllerDidHideMenuNotification = @"UIMenuControllerDidHideMenuNotification"; NSString *const UIMenuControllerMenuFrameDidChangeNotification = @"UIMenuControllerMenuFrameDidChangeNotification"; @interface UIMenuController () @end @implementation UIMenuController @synthesize menuItems=_menuItems, menuFrame=_menuFrame; + (UIMenuController *)sharedMenuController { static UIMenuController *controller = nil; return controller ?: (controller = [[UIMenuController alloc] init]); } + (NSArray *)_defaultMenuItems { static NSArray *items = nil; if (!items) { items = [[NSArray alloc] initWithObjects: [[[UIMenuItem alloc] initWithTitle:@"Cut" action:@selector(cut:)] autorelease], [[[UIMenuItem alloc] initWithTitle:@"Copy" action:@selector(copy:)] autorelease], [[[UIMenuItem alloc] initWithTitle:@"Paste" action:@selector(paste:)] autorelease], [[[UIMenuItem alloc] initWithTitle:@"Delete" action:@selector(delete:)] autorelease], [[[UIMenuItem alloc] initWithTitle:@"Select" action:@selector(select:)] autorelease], [[[UIMenuItem alloc] initWithTitle:@"Select All" action:@selector(selectAll:)] autorelease], nil]; } return items; } - (id)init { if ((self=[super init])) { _enabledMenuItems = [[NSMutableArray alloc] init]; } return self; } - (void)dealloc { [_menuItems release]; [_enabledMenuItems release]; [_menu cancelTracking]; // this should never really happen since the controller is pretty much always a singleton, but... whatever. [_menu release]; [super dealloc]; } - (BOOL)isMenuVisible { return (_menu != nil); } - (void)setMenuVisible:(BOOL)menuVisible animated:(BOOL)animated { const BOOL wasVisible = [self isMenuVisible]; if (menuVisible && !wasVisible) { [self update]; if ([_enabledMenuItems count] > 0) { _menu = [[NSMenu alloc] initWithTitle:@""]; [_menu setDelegate:self]; [_menu setAutoenablesItems:NO]; [_menu setAllowsContextMenuPlugIns:NO]; for (UIMenuItem *item in _enabledMenuItems) { NSMenuItem *theItem = [[NSMenuItem alloc] initWithTitle:item.title action:@selector(_didSelectMenuItem:) keyEquivalent:@""]; [theItem setTarget:self]; [theItem setRepresentedObject:item]; [_menu addItem:theItem]; [theItem release]; } _menuFrame.size = NSSizeToCGSize([_menu size]); _menuFrame.origin = _menuLocation; // this is offset so that it seems to be aligned on the right of the initial rect given to setTargetRect:inView: // I don't know if this is the best behavior yet or not. if (_rightAlignMenu) { _menuFrame.origin.x -= _menuFrame.size.width; } // note that presenting an NSMenu is apparently modal. so, to pretend that it isn't, exactly, I'll delay the presentation // of the menu to the start of a new runloop. At least that way, code that may be expecting to run right after setting the // menu to visible would still run before the menu itself shows up on screen. Of course behavior is going to be pretty different // after that point since if the app is assuming it can keep on doing normal runloop stuff, it ain't gonna happen. // but since clicks outside of an NSMenu dismiss it, there's not a lot a user can do to an app to change state when a menu // is up in the first place. [self performSelector:@selector(_presentMenu) withObject:nil afterDelay:0]; } } else if (!menuVisible && wasVisible) { // make it unhappen if (animated) { [_menu cancelTracking]; } else { [_menu cancelTrackingWithoutAnimation]; } [_menu release]; _menu = nil; } } - (void)setMenuVisible:(BOOL)visible { [self setMenuVisible:visible animated:NO]; } - (void)setTargetRect:(CGRect)targetRect inView:(UIView *)targetView { // we have to have some window somewhere to use as a basis, so if there isn't a view, we'll just use the // keyWindow and go from there. _window = targetView.window ?: [UIApplication sharedApplication].keyWindow; // if the rect is CGRectNull, this is a fancy trigger in my OSX version to use the mouse position as the location for // the menu instead of the requiring a given rect. this is often a much better feel on OSX than the usual UIKit way is. if (CGRectIsNull(targetRect)) { _rightAlignMenu = NO; // get the mouse position and use that as the origin of our target rect NSPoint mouseLocation = [NSEvent mouseLocation]; CGPoint screenPoint = [_window.screen convertPoint:NSPointToCGPoint(mouseLocation) fromScreen:nil]; targetRect.origin = screenPoint; targetRect.size = CGSizeZero; } else { _rightAlignMenu = YES; // this will ultimately position the menu under the lower right of the given rectangle. // but it is then shifted in setMenuVisible:animated: so that the menu is right-aligned with the given rect. // this is all rather strange, perhaps, but it made sense at the time. we'll see if it does in practice. targetRect.origin.x += targetRect.size.width; targetRect.origin.y += targetRect.size.height; // first convert to screen coord, otherwise assume it already is, I guess, only the catch with targetView being nil // is that the assumed screen might not be the keyWindow's screen, which is what I'm going to be assuming here. // but bah - who cares? :) if (targetView) { targetRect = [_window convertRect:[_window convertRect:targetRect fromView:targetView] toWindow:nil]; } } // only the origin is being set here. the size isn't known until the menu is created, which happens in setMenuVisible:animated: // so that's where _menuFrame will actually be configured for now. _menuLocation = targetRect.origin; } - (void)update { UIApplication *app = [UIApplication sharedApplication]; UIResponder *firstResponder = [app.keyWindow _firstResponder]; NSArray *allItems = [[[self class] _defaultMenuItems] arrayByAddingObjectsFromArray:_menuItems]; [_enabledMenuItems removeAllObjects]; if (firstResponder) { for (UIMenuItem *item in allItems) { if ([firstResponder canPerformAction:item.action withSender:app]) { [_enabledMenuItems addObject:item]; } } } } - (void)_presentMenu { if (_menu && _window) { NSView *theNSView = [_window.screen UIKitView]; if (theNSView) { [_menu popUpMenuPositioningItem:nil atLocation:NSPointFromCGPoint(_menuFrame.origin) inView:theNSView]; [[UIApplication sharedApplication] _cancelTouches]; } } } - (void)_didSelectMenuItem:(NSMenuItem *)sender { // the docs say that it calls -update when it detects a touch in the menu, so I assume it does this to try to prevent actions being sent // that perhaps have just been un-enabled due to something else that happened since the menu first appeared. To replicate that, I'll just // call update again here to rebuild the list of allowed actions and then do one final check to make sure that the requested action has // not been disabled out from under us. [self update]; UIApplication *app = [UIApplication sharedApplication]; UIResponder *firstResponder = [app.keyWindow _firstResponder]; UIMenuItem *selectedItem = [sender representedObject]; // now spin through the enabled actions, make sure the selected one is still in there, and then send it if it is. if (firstResponder && selectedItem) { for (UIMenuItem *item in _enabledMenuItems) { if (item.action == selectedItem.action) { [app sendAction:item.action to:firstResponder from:app forEvent:nil]; break; } } } } - (void)menuDidClose:(NSMenu *)menu { if (menu == _menu) { [_menu release]; _menu = nil; } } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIMenuItem.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @interface UIMenuItem : NSObject { @private SEL _action; NSString *_title; } - (id)initWithTitle:(NSString *)title action:(SEL)action; @property SEL action; @property (copy) NSString *title; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIMenuItem.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIMenuItem.h" @implementation UIMenuItem @synthesize action=_action, title=_title; - (id)initWithTitle:(NSString *)title action:(SEL)action { if ((self=[super init])) { self.title = title; self.action = action; } return self; } - (void)dealloc { [_title release]; [super dealloc]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UINSClipView.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @class UIScrollView; @interface UINSClipView : NSClipView { UIScrollView *parentView; } - (id)initWithFrame:(NSRect)frame parentView:(UIScrollView *)aView; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UINSClipView.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UINSClipView.h" #import "UIScrollView+UIPrivate.h" #import "UIWindow.h" #import "UIScreen+UIPrivate.h" #import "UIScreenAppKitIntegration.h" #import "UIKitView.h" #import @implementation UINSClipView - (id)initWithFrame:(NSRect)frame parentView:(UIScrollView *)aView { if ((self=[super initWithFrame:frame])) { parentView = aView; [self setDrawsBackground:NO]; [self setCopiesOnScroll:NO]; [self setWantsLayer:YES]; [self setAutoresizingMask:NSViewNotSizable]; } return self; } - (BOOL)isFlipped { return YES; } - (BOOL)isOpaque { return NO; } - (void)scrollWheel:(NSEvent *)event { if (parentView.scrollEnabled) { NSPoint offset = [self bounds].origin; offset.x -= [event deltaX]; offset.y -= [event deltaY]; [parentView _quickFlashScrollIndicators]; [parentView setContentOffset:NSPointToCGPoint(offset) animated:NO]; } else { [super scrollWheel:event]; } } - (void)viewDidMoveToSuperview { [super viewDidMoveToSuperview]; [parentView setNeedsLayout]; } - (void)viewWillDraw { [parentView setNeedsLayout]; [super viewWillDraw]; } - (void)setFrame:(NSRect)frame { [super setFrame:frame]; [parentView setNeedsLayout]; } // this is used to fake out AppKit when the UIView that "owns" this NSView's layer is actually *behind* another UIView. Since the NSViews are // technically above all of the UIViews, they'd normally capture all clicks no matter what might happen to be obscuring them. That would obviously // be less than ideal. This makes it ideal. It is awesome. - (NSView *)hitTest:(NSPoint)aPoint { NSView *hitNSView = [super hitTest:aPoint]; if (hitNSView) { UIScreen *screen = parentView.window.screen; BOOL didHitUIView = NO; if (screen) { if (![[screen UIKitView] isFlipped]) { aPoint.y = screen.bounds.size.height - aPoint.y - 1; } didHitUIView = (parentView == [screen _hitTest:NSPointToCGPoint(aPoint) event:nil]); } if (!didHitUIView) { hitNSView = nil; } } return hitNSView; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UINavigationBar+UIPrivate.h ================================================ // // UINavigationBar+UIPrivate.h // UIKit // // Created by Jim Dovey on 11-03-22. // /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UINavigationBar.h" @interface UINavigationBar (UIPrivate) - (void)_updateNavigationItem:(UINavigationItem *)item animated:(BOOL)animated; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UINavigationBar.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIToolbar.h" #import "UIView.h" @class UIColor, UINavigationItem, UINavigationBar; @protocol UINavigationBarDelegate @optional - (BOOL)navigationBar:(UINavigationBar *)navigationBar shouldPushItem:(UINavigationItem *)item; - (void)navigationBar:(UINavigationBar *)navigationBar didPushItem:(UINavigationItem *)item; - (BOOL)navigationBar:(UINavigationBar *)navigationBar shouldPopItem:(UINavigationItem *)item; - (void)navigationBar:(UINavigationBar *)navigationBar didPopItem:(UINavigationItem *)item; @end @interface UINavigationBar : UIView { @private NSMutableArray *_navStack; UIColor *_tintColor; __unsafe_unretained id _delegate; UIView *_leftView; UIView *_centerView; UIView *_rightView; struct { unsigned shouldPushItem : 1; unsigned didPushItem : 1; unsigned shouldPopItem : 1; unsigned didPopItem : 1; } _delegateHas; // ideally this should share the same memory as the above flags structure... struct { unsigned reloadItem : 1; unsigned __RESERVED__ : 31; } _navigationBarFlags; } - (void)setItems:(NSArray *)items animated:(BOOL)animated; - (void)pushNavigationItem:(UINavigationItem *)item animated:(BOOL)animated; - (UINavigationItem *)popNavigationItemAnimated:(BOOL)animated; @property (nonatomic, assign) UIBarStyle barStyle; @property (nonatomic, strong) UIColor *tintColor; @property (nonatomic, readonly, strong) UINavigationItem *topItem; @property (nonatomic, readonly, strong) UINavigationItem *backItem; @property (nonatomic, copy) NSArray *items; @property (nonatomic, assign) id delegate; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UINavigationBar.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UINavigationBar.h" #import "UINavigationBar+UIPrivate.h" #import "UIGraphics.h" #import "UIColor.h" #import "UILabel.h" #import "UINavigationItem.h" #import "UINavigationItem+UIPrivate.h" #import "UIFont.h" #import "UIImage+UIPrivate.h" #import "UIBarButtonItem.h" #import "UIButton.h" static const UIEdgeInsets kButtonEdgeInsets = {0,0,0,0}; static const CGFloat kMinButtonWidth = 30; static const CGFloat kMaxButtonWidth = 200; static const CGFloat kMaxButtonHeight = 24; static const NSTimeInterval kAnimationDuration = 0.33; typedef enum { _UINavigationBarTransitionPush, _UINavigationBarTransitionPop, _UINavigationBarTransitionReload // explicitly tag reloads from changed UINavigationItem data } _UINavigationBarTransition; @implementation UINavigationBar @synthesize tintColor=_tintColor, delegate=_delegate, items=_navStack; + (void)_setBarButtonSize:(UIView *)view { CGRect frame = view.frame; frame.size = [view sizeThatFits:CGSizeMake(kMaxButtonWidth,kMaxButtonHeight)]; frame.size.height = kMaxButtonHeight; frame.size.width = MAX(frame.size.width,kMinButtonWidth); view.frame = frame; } + (UIButton *)_backButtonWithBarButtonItem:(UIBarButtonItem *)item { if (!item) return nil; UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom]; [backButton setBackgroundImage:[UIImage _backButtonImage] forState:UIControlStateNormal]; [backButton setBackgroundImage:[UIImage _highlightedBackButtonImage] forState:UIControlStateHighlighted]; [backButton setTitle:item.title forState:UIControlStateNormal]; backButton.titleLabel.font = [UIFont systemFontOfSize:11]; backButton.contentEdgeInsets = UIEdgeInsetsMake(0,15,0,7); [backButton addTarget:nil action:@selector(_backButtonTapped:) forControlEvents:UIControlEventTouchUpInside]; [self _setBarButtonSize:backButton]; return backButton; } + (UIView *)_viewWithBarButtonItem:(UIBarButtonItem *)item { if (!item) return nil; if (item.customView) { [self _setBarButtonSize:item.customView]; return item.customView; } else { UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; [button setBackgroundImage:[UIImage _toolbarButtonImage] forState:UIControlStateNormal]; [button setBackgroundImage:[UIImage _highlightedToolbarButtonImage] forState:UIControlStateHighlighted]; [button setTitle:item.title forState:UIControlStateNormal]; [button setImage:item.image forState:UIControlStateNormal]; button.titleLabel.font = [UIFont systemFontOfSize:11]; button.contentEdgeInsets = UIEdgeInsetsMake(0,7,0,7); [button addTarget:item.target action:item.action forControlEvents:UIControlEventTouchUpInside]; [self _setBarButtonSize:button]; return button; } } - (id)initWithFrame:(CGRect)frame { if ((self=[super initWithFrame:frame])) { _navStack = [[NSMutableArray alloc] init]; self.tintColor = [UIColor colorWithRed:21/255.f green:21/255.f blue:25/255.f alpha:1]; } return self; } - (void)dealloc { [self.topItem _setNavigationBar: nil]; [_navStack release]; [_tintColor release]; [super dealloc]; } - (void)setDelegate:(id)newDelegate { _delegate = newDelegate; _delegateHas.shouldPushItem = [_delegate respondsToSelector:@selector(navigationBar:shouldPushItem:)]; _delegateHas.didPushItem = [_delegate respondsToSelector:@selector(navigationBar:didPushItem:)]; _delegateHas.shouldPopItem = [_delegate respondsToSelector:@selector(navigationBar:shouldPopItem:)]; _delegateHas.didPopItem = [_delegate respondsToSelector:@selector(navigationBar:didPopItem:)]; } - (UINavigationItem *)topItem { return [_navStack lastObject]; } - (UINavigationItem *)backItem { return ([_navStack count] <= 1)? nil : [_navStack objectAtIndex:[_navStack count]-2]; } - (void)_backButtonTapped:(id)sender { [self popNavigationItemAnimated:YES]; } - (void)_removeAnimatedViews:(NSArray *)views { [views makeObjectsPerformSelector:@selector(removeFromSuperview)]; } - (void)_setViewsWithTransition:(_UINavigationBarTransition)transition animated:(BOOL)animated { { NSMutableArray *previousViews = [[NSMutableArray alloc] init]; if (_leftView) [previousViews addObject:_leftView]; if (_centerView) [previousViews addObject:_centerView]; if (_rightView) [previousViews addObject:_rightView]; if (animated) { CGFloat moveCenterBy = self.bounds.size.width - ((_centerView)? _centerView.frame.origin.x : 0); CGFloat moveLeftBy = self.bounds.size.width * 0.33f; if (transition == _UINavigationBarTransitionPush) { moveCenterBy *= -1.f; moveLeftBy *= -1.f; } [UIView animateWithDuration:kAnimationDuration animations:^(void) { if (_leftView) _leftView.frame = CGRectOffset(_leftView.frame, moveLeftBy, 0); if (_centerView) _centerView.frame = CGRectOffset(_centerView.frame, moveCenterBy, 0); }]; [UIView animateWithDuration:kAnimationDuration * 0.8 delay:kAnimationDuration * 0.2 options:UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionTransitionNone animations:^(void) { _leftView.alpha = 0; _rightView.alpha = 0; _centerView.alpha = 0; } completion:NULL]; [self performSelector:@selector(_removeAnimatedViews:) withObject:previousViews afterDelay:kAnimationDuration]; } else { [self _removeAnimatedViews:previousViews]; } [previousViews release]; } UINavigationItem *topItem = self.topItem; if (topItem) { UINavigationItem *backItem = self.backItem; // update weak references [backItem _setNavigationBar: nil]; [topItem _setNavigationBar: self]; CGRect leftFrame = CGRectZero; CGRect rightFrame = CGRectZero; if (backItem) { _leftView = [[self class] _backButtonWithBarButtonItem:backItem.backBarButtonItem]; } else { _leftView = [[self class] _viewWithBarButtonItem:topItem.leftBarButtonItem]; } if (_leftView) { leftFrame = _leftView.frame; leftFrame.origin = CGPointMake(kButtonEdgeInsets.left, kButtonEdgeInsets.top); _leftView.frame = leftFrame; [self addSubview:_leftView]; } _rightView = [[self class] _viewWithBarButtonItem:topItem.rightBarButtonItem]; if (_rightView) { _rightView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin; rightFrame = _rightView.frame; rightFrame.origin.x = self.bounds.size.width-rightFrame.size.width - kButtonEdgeInsets.right; rightFrame.origin.y = kButtonEdgeInsets.top; _rightView.frame = rightFrame; [self addSubview:_rightView]; } _centerView = topItem.titleView; if (!_centerView) { UILabel *titleLabel = [[[UILabel alloc] init] autorelease]; titleLabel.text = topItem.title; titleLabel.textAlignment = UITextAlignmentCenter; titleLabel.backgroundColor = [UIColor clearColor]; titleLabel.textColor = [UIColor whiteColor]; titleLabel.font = [UIFont boldSystemFontOfSize:14]; _centerView = titleLabel; } const CGFloat centerPadding = MAX(leftFrame.size.width, rightFrame.size.width); _centerView.autoresizingMask = UIViewAutoresizingFlexibleWidth; _centerView.frame = CGRectMake(kButtonEdgeInsets.left+centerPadding,kButtonEdgeInsets.top,self.bounds.size.width-kButtonEdgeInsets.right-kButtonEdgeInsets.left-centerPadding-centerPadding,kMaxButtonHeight); [self addSubview:_centerView]; if (animated) { CGFloat moveCenterBy = self.bounds.size.width - ((_centerView)? _centerView.frame.origin.x : 0); CGFloat moveLeftBy = self.bounds.size.width * 0.33f; if (transition == _UINavigationBarTransitionPush) { moveLeftBy *= -1.f; moveCenterBy *= -1.f; } CGRect destinationLeftFrame = _leftView? _leftView.frame : CGRectZero; CGRect destinationCenterFrame = _centerView? _centerView.frame : CGRectZero; if (_leftView) _leftView.frame = CGRectOffset(_leftView.frame, -moveLeftBy, 0); if (_centerView) _centerView.frame = CGRectOffset(_centerView.frame, -moveCenterBy, 0); _leftView.alpha = 0; _rightView.alpha = 0; _centerView.alpha = 0; [UIView animateWithDuration:kAnimationDuration animations:^(void) { _leftView.frame = destinationLeftFrame; _centerView.frame = destinationCenterFrame; }]; [UIView animateWithDuration:kAnimationDuration * 0.8 delay:kAnimationDuration * 0.2 options:UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionTransitionNone animations:^(void) { _leftView.alpha = 1; _rightView.alpha = 1; _centerView.alpha = 1; } completion:NULL]; } } else { _leftView = _centerView = _rightView = nil; } } - (void)setTintColor:(UIColor *)newColor { if (newColor != _tintColor) { [_tintColor release]; _tintColor = [newColor retain]; [self setNeedsDisplay]; } } - (void)setItems:(NSArray *)items animated:(BOOL)animated { if (![_navStack isEqualToArray:items]) { [_navStack removeAllObjects]; [_navStack addObjectsFromArray:items]; [self _setViewsWithTransition:_UINavigationBarTransitionPush animated:animated]; } } - (void)setItems:(NSArray *)items { [self setItems:items animated:NO]; } - (UIBarStyle)barStyle { return UIBarStyleDefault; } - (void)setBarStyle:(UIBarStyle)barStyle { } - (void)pushNavigationItem:(UINavigationItem *)item animated:(BOOL)animated { BOOL shouldPush = YES; if (_delegateHas.shouldPushItem) { shouldPush = [_delegate navigationBar:self shouldPushItem:item]; } if (shouldPush) { [_navStack addObject:item]; [self _setViewsWithTransition:_UINavigationBarTransitionPush animated:animated]; if (_delegateHas.didPushItem) { [_delegate navigationBar:self didPushItem:item]; } } } - (UINavigationItem *)popNavigationItemAnimated:(BOOL)animated { UINavigationItem *previousItem = self.topItem; if (previousItem) { BOOL shouldPop = YES; if (_delegateHas.shouldPopItem) { shouldPop = [_delegate navigationBar:self shouldPopItem:previousItem]; } if (shouldPop) { [previousItem retain]; [_navStack removeObject:previousItem]; [self _setViewsWithTransition:_UINavigationBarTransitionPop animated:animated]; if (_delegateHas.didPopItem) { [_delegate navigationBar:self didPopItem:previousItem]; } return [previousItem autorelease]; } } return nil; } - (void)_updateNavigationItem:(UINavigationItem *)item animated:(BOOL)animated // ignored for now { // let's sanity-check that the item is supposed to be talking to us if (item != self.topItem) { [item _setNavigationBar:nil]; return; } // this is going to remove & re-add all the item views. Not ideal, but simple enough that it's worth profiling. // next step is to add animation support-- that will require changing _setViewsWithTransition:animated: // such that it won't perform any coordinate translations, only fade in/out // don't just fire the damned thing-- set a flag & mark as needing layout if (_navigationBarFlags.reloadItem == 0) { _navigationBarFlags.reloadItem = 1; [self setNeedsLayout]; } } - (void)layoutSubviews { [super layoutSubviews]; if (_navigationBarFlags.reloadItem) { _navigationBarFlags.reloadItem = 0; [self _setViewsWithTransition:_UINavigationBarTransitionReload animated:NO]; } } - (void)drawRect:(CGRect)rect { const CGRect bounds = self.bounds; // I kind of suspect that the "right" thing to do is to draw the background and then paint over it with the tintColor doing some kind of blending // so that it actually doesn "tint" the image instead of define it. That'd probably work better with the bottom line coloring and stuff, too, but // for now hardcoding stuff works well enough. [_tintColor setFill]; UIRectFill(bounds); } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UINavigationController.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIViewController.h" @class UINavigationBar, UIToolbar, UIViewController; @protocol UINavigationControllerDelegate @optional - (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated; - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated; @end typedef enum { _UINavigationControllerVisibleControllerTransitionNone = 0, _UINavigationControllerVisibleControllerTransitionPushAnimated, _UINavigationControllerVisibleControllerTransitionPopAnimated } _UINavigationControllerVisibleControllerTransition; @interface UINavigationController : UIViewController { @private UINavigationBar *_navigationBar; UIToolbar *_toolbar; NSMutableArray *_viewControllers; __unsafe_unretained id _delegate; BOOL _toolbarHidden; BOOL _navigationBarHidden; BOOL _visibleViewControllerNeedsUpdate; _UINavigationControllerVisibleControllerTransition _visibleViewControllerTransition; UIViewController *_visibleViewController; struct { unsigned didShowViewController : 1; unsigned willShowViewController : 1; } _delegateHas; } - (id)initWithRootViewController:(UIViewController *)rootViewController; - (void)setViewControllers:(NSArray *)newViewControllers animated:(BOOL)animated; - (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated; - (UIViewController *)popViewControllerAnimated:(BOOL)animated; - (NSArray *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated; - (NSArray *)popToRootViewControllerAnimated:(BOOL)animated; - (void)setToolbarHidden:(BOOL)hidden animated:(BOOL)animated; // toolbar support is not really implemented yet - (void)setNavigationBarHidden:(BOOL)navigationBarHidden animated:(BOOL)animated; // doesn't animate yet @property (nonatomic, copy) NSArray *viewControllers; @property (nonatomic, readonly, strong) UIViewController *visibleViewController; @property (nonatomic, readonly) UINavigationBar *navigationBar; @property (nonatomic, readonly) UIToolbar *toolbar; // toolbar support is not really implemented yet @property (nonatomic, assign) id delegate; @property (nonatomic, readonly, strong) UIViewController *topViewController; @property (nonatomic,getter=isNavigationBarHidden) BOOL navigationBarHidden; @property (nonatomic,getter=isToolbarHidden) BOOL toolbarHidden; // toolbar support is not really implemented yet @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UINavigationController.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UINavigationController.h" #import "UIViewController+UIPrivate.h" #import "UITabBarController.h" #import "UINavigationBar.h" #import "UIToolbar.h" static const NSTimeInterval kAnimationDuration = 0.33; static const CGFloat NavBarHeight = 28; static const CGFloat ToolbarHeight = 28; @implementation UINavigationController @synthesize viewControllers=_viewControllers, delegate=_delegate, navigationBar=_navigationBar; @synthesize toolbar=_toolbar, toolbarHidden=_toolbarHidden, navigationBarHidden=_navigationBarHidden; @synthesize visibleViewController=_visibleViewController; - (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)bundle { if ((self=[super initWithNibName:nibName bundle:bundle])) { _viewControllers = [[NSMutableArray alloc] initWithCapacity:1]; _navigationBar = [[UINavigationBar alloc] init]; _navigationBar.delegate = self; _toolbar = [[UIToolbar alloc] init]; _toolbarHidden = YES; } return self; } - (id)initWithRootViewController:(UIViewController *)rootViewController { if ((self=[self initWithNibName:nil bundle:nil])) { self.viewControllers = [NSArray arrayWithObject:rootViewController]; } return self; } - (void)dealloc { _navigationBar.delegate = nil; [_viewControllers release]; [_visibleViewController release]; [_navigationBar release]; [_toolbar release]; [super dealloc]; } - (void)setDelegate:(id)newDelegate { _delegate = newDelegate; _delegateHas.didShowViewController = [_delegate respondsToSelector:@selector(navigationController:didShowViewController:animated:)]; _delegateHas.willShowViewController = [_delegate respondsToSelector:@selector(navigationController:willShowViewController:animated:)]; } - (CGRect)_navigationBarFrame { CGRect navBarFrame = self.view.bounds; navBarFrame.size.height = NavBarHeight; return navBarFrame; } - (CGRect)_toolbarFrame { CGRect toolbarRect = self.view.bounds; toolbarRect.origin.y = toolbarRect.origin.y + toolbarRect.size.height - ToolbarHeight; toolbarRect.size.height = ToolbarHeight; return toolbarRect; } - (CGRect)_controllerFrameForTransition:(_UINavigationControllerVisibleControllerTransition)transition { CGRect controllerFrame = self.view.bounds; // adjust for the nav bar if (!self.navigationBarHidden) { controllerFrame.origin.y += NavBarHeight; controllerFrame.size.height -= NavBarHeight; } // adjust for toolbar (if there is one) if (!self.toolbarHidden) { controllerFrame.size.height -= ToolbarHeight; } if (transition == _UINavigationControllerVisibleControllerTransitionPushAnimated) { controllerFrame = CGRectOffset(controllerFrame, controllerFrame.size.width, 0); } else if (transition == _UINavigationControllerVisibleControllerTransitionPopAnimated) { controllerFrame = CGRectOffset(controllerFrame, -controllerFrame.size.width, 0); } return controllerFrame; } - (void)_setVisibleViewControllerNeedsUpdate { // schedules a deferred method to run if (!_visibleViewControllerNeedsUpdate) { _visibleViewControllerNeedsUpdate = YES; [self performSelector:@selector(_updateVisibleViewController) withObject:nil afterDelay:0]; } } - (void)_updateVisibleViewController { // do some bookkeeping _visibleViewControllerNeedsUpdate = NO; UIViewController *topViewController = [self.topViewController retain]; // make sure the new top view is both loaded and set to appear in the correct place topViewController.view.frame = [self _controllerFrameForTransition:_visibleViewControllerTransition]; if (_visibleViewControllerTransition == _UINavigationControllerVisibleControllerTransitionNone) { [_visibleViewController viewWillDisappear:NO]; [topViewController viewWillAppear:NO]; if (_delegateHas.willShowViewController) { [_delegate navigationController:self willShowViewController:topViewController animated:NO]; } [_visibleViewController.view removeFromSuperview]; [self.view insertSubview:topViewController.view atIndex:0]; [_visibleViewController viewDidDisappear:NO]; [topViewController viewDidAppear:NO]; if (_delegateHas.didShowViewController) { [_delegate navigationController:self didShowViewController:topViewController animated:NO]; } } else { const CGRect visibleControllerFrame = (_visibleViewControllerTransition == _UINavigationControllerVisibleControllerTransitionPushAnimated) ? [self _controllerFrameForTransition:_UINavigationControllerVisibleControllerTransitionPopAnimated] : [self _controllerFrameForTransition:_UINavigationControllerVisibleControllerTransitionPushAnimated]; const CGRect topControllerFrame = [self _controllerFrameForTransition:_UINavigationControllerVisibleControllerTransitionNone]; UIViewController *previouslyVisibleViewController = _visibleViewController; [UIView animateWithDuration:kAnimationDuration animations:^(void) { previouslyVisibleViewController.view.frame = visibleControllerFrame; topViewController.view.frame = topControllerFrame; } completion:^(BOOL finished) { [previouslyVisibleViewController.view removeFromSuperview]; [previouslyVisibleViewController viewDidDisappear:YES]; [topViewController viewDidAppear:YES]; if (_delegateHas.didShowViewController) { [_delegate navigationController:self didShowViewController:topViewController animated:YES]; } }]; } [_visibleViewController release]; _visibleViewController = [topViewController retain]; [topViewController release]; } - (void)loadView { self.view = [[[UIView alloc] initWithFrame:CGRectMake(0,0,320,480)] autorelease]; self.view.clipsToBounds = YES; UIViewController *viewController = self.visibleViewController; viewController.view.frame = [self _controllerFrameForTransition:_UINavigationControllerVisibleControllerTransitionNone]; viewController.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; [self.view addSubview:viewController.view]; _navigationBar.frame = [self _navigationBarFrame]; _navigationBar.autoresizingMask = UIViewAutoresizingFlexibleWidth; _navigationBar.hidden = self.navigationBarHidden; [self.view addSubview:_navigationBar]; _toolbar.frame = [self _toolbarFrame]; _toolbar.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin; _toolbar.hidden = self.toolbarHidden; [self.view addSubview:_toolbar]; } - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [self.visibleViewController viewWillAppear:animated]; } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [self.visibleViewController viewDidAppear:animated]; } - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; [self.visibleViewController viewWillDisappear:animated]; } - (void)viewDidDisappear:(BOOL)animated { [super viewDidDisappear:animated]; [self.visibleViewController viewDidDisappear:animated]; } - (void)setViewControllers:(NSArray *)newViewControllers animated:(BOOL)animated { assert([newViewControllers count] >= 1); if (![newViewControllers isEqualToArray:_viewControllers]) { // remove them all in bulk [_viewControllers makeObjectsPerformSelector:@selector(_setParentViewController:) withObject:nil]; [_viewControllers removeAllObjects]; // reset the nav bar _navigationBar.items = nil; // add them back in one-by-one and only apply animation to the last one (if any) for (UIViewController *controller in newViewControllers) { [self pushViewController:controller animated:(animated && (controller == [newViewControllers lastObject]))]; } } } - (void)setViewControllers:(NSArray *)newViewControllers { [self setViewControllers:newViewControllers animated:NO]; } - (UIViewController *)topViewController { return [_viewControllers lastObject]; } - (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated { assert(![viewController isKindOfClass:[UITabBarController class]]); assert(![_viewControllers containsObject:viewController]); // override the animated property based on current state animated = animated && _visibleViewController && self.view.window; // push on to controllers stack [_viewControllers addObject:viewController]; [_navigationBar pushNavigationItem:viewController.navigationItem animated:animated]; // take ownership responsibility [viewController _setParentViewController:self]; // if animated and on screen, begin part of the transition immediately, specifically, get the new view // on screen asap and tell the new controller it's about to be made visible in an animated fashion if (animated) { _visibleViewControllerTransition = _UINavigationControllerVisibleControllerTransitionPushAnimated; viewController.view.frame = [self _controllerFrameForTransition:_visibleViewControllerTransition]; [_visibleViewController viewWillDisappear:YES]; [viewController viewWillAppear:YES]; if (_delegateHas.willShowViewController) { [_delegate navigationController:self willShowViewController:viewController animated:YES]; } [self.view insertSubview:viewController.view atIndex:0]; } [self _setVisibleViewControllerNeedsUpdate]; } - (UIViewController *)popViewControllerAnimated:(BOOL)animated { // don't allow popping the rootViewController if ([_viewControllers count] <= 1) { return nil; } UIViewController *formerTopViewController = [self.topViewController retain]; // adjust the animate property animated = animated && self.view.window; // pop the controller stack [_viewControllers removeLastObject]; // pop the nav bar - note that it's setting the delegate to nil and back because we use the nav bar's // -navigationBar:shouldPopItem: delegate method to determine when the user clicks the back button // but that method is also called when we do an animated pop like this, so this works around the cycle. // I don't love it. _navigationBar.delegate = nil; [_navigationBar popNavigationItemAnimated:animated]; _navigationBar.delegate = self; // give up ownership of the view controller [formerTopViewController _setParentViewController:nil]; // if animated, begin part of the transition immediately, specifically, get the new top view on screen asap // and tell the old visible controller it's about to be disappeared in an animated fashion if (animated && self.view.window) { // note the new top here so we don't have to use the accessor method all the time UIViewController *topController = [self.topViewController retain]; _visibleViewControllerTransition = _UINavigationControllerVisibleControllerTransitionPopAnimated; // if we never updated the visible controller, we need to add the formerTopViewController // on to the screen so we can see it disappear since we're attempting to animate this if (!_visibleViewController) { _visibleViewController = [formerTopViewController retain]; _visibleViewController.view.frame = [self _controllerFrameForTransition:_UINavigationControllerVisibleControllerTransitionNone]; [self.view insertSubview:_visibleViewController.view atIndex:0]; } topController.view.frame = [self _controllerFrameForTransition:_visibleViewControllerTransition]; [_visibleViewController viewWillDisappear:YES]; [topController viewWillAppear:YES]; if (_delegateHas.willShowViewController) { [_delegate navigationController:self willShowViewController:topController animated:YES]; } [self.view insertSubview:topController.view atIndex:0]; [topController release]; } [self _setVisibleViewControllerNeedsUpdate]; return [formerTopViewController autorelease]; } - (NSArray *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated { NSMutableArray *popped = [[NSMutableArray alloc] init]; if ([_viewControllers containsObject:viewController]) { while (self.topViewController != viewController) { UIViewController *poppedController = [self popViewControllerAnimated:animated]; if (poppedController) { [popped addObject:poppedController]; } else { break; } } } return [popped autorelease]; } - (NSArray *)popToRootViewControllerAnimated:(BOOL)animated { return [self popToViewController:[_viewControllers objectAtIndex:0] animated:animated]; } - (BOOL)navigationBar:(UINavigationBar *)navigationBar shouldPopItem:(UINavigationItem *)item { // always initiate an animated pop and return NO so that the nav bar itself doesn't take it upon itself // to pop the item, instead popViewControllerAnimated: will command it to do so later. [self popViewControllerAnimated:YES]; return NO; } - (void)setToolbarHidden:(BOOL)hidden animated:(BOOL)animated { _toolbarHidden = hidden; _toolbar.hidden = hidden; } - (void)setToolbarHidden:(BOOL)hidden { [self setToolbarHidden:hidden animated:NO]; } - (BOOL)isToolbarHidden { return _toolbarHidden || self.topViewController.hidesBottomBarWhenPushed; } - (void)setContentSizeForViewInPopover:(CGSize)newSize { self.topViewController.contentSizeForViewInPopover = newSize; } - (CGSize)contentSizeForViewInPopover { return self.topViewController.contentSizeForViewInPopover; } - (void)setNavigationBarHidden:(BOOL)navigationBarHidden animated:(BOOL)animated; // doesn't yet animate { _navigationBarHidden = navigationBarHidden; // this shouldn't just hide it, but should animate it out of view (if animated==YES) and then adjust the layout // so the main view fills the whole space, etc. _navigationBar.hidden = navigationBarHidden; } - (void)setNavigationBarHidden:(BOOL)navigationBarHidden { [self setNavigationBarHidden:navigationBarHidden animated:NO]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UINavigationItem+UIPrivate.h ================================================ // // UINavigationItem+UIPrivate.h // UIKit // // Created by Jim Dovey on 11-03-22. // /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UINavigationItem.h" @class UINavigationBar; @interface UINavigationItem (UIPrivate) - (void)_setNavigationBar:(UINavigationBar *)navigationBar; - (UINavigationBar *)_navigationBar; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UINavigationItem.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @class UIBarButtonItem, UIView, UINavigationBar; @interface UINavigationItem : NSObject { @private NSString *_title; NSString *_prompt; UIBarButtonItem *_backBarButtonItem; UIBarButtonItem *_leftBarButtonItem; UIBarButtonItem *_rightBarButtonItem; UIView *_titleView; BOOL _hidesBackButton; UINavigationBar *_navigationBar; } - (id)initWithTitle:(NSString *)title; - (void)setLeftBarButtonItem:(UIBarButtonItem *)item animated:(BOOL)animated; - (void)setRightBarButtonItem:(UIBarButtonItem *)item animated:(BOOL)animated; - (void)setHidesBackButton:(BOOL)hidesBackButton animated:(BOOL)animated; @property (nonatomic, copy) NSString *title; @property (nonatomic, copy) NSString *prompt; @property (nonatomic, strong) UIBarButtonItem *backBarButtonItem; @property (nonatomic, strong) UIBarButtonItem *leftBarButtonItem; @property (nonatomic, strong) UIBarButtonItem *rightBarButtonItem; @property (nonatomic, strong) UIView *titleView; @property (nonatomic, assign) BOOL hidesBackButton; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UINavigationItem.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UINavigationItem.h" #import "UIBarButtonItem.h" #import "UINavigationItem+UIPrivate.h" #import "UINavigationBar.h" #import "UINavigationBar+UIPrivate.h" static void * const UINavigationItemContext = "UINavigationItemContext"; @implementation UINavigationItem @synthesize title=_title, rightBarButtonItem=_rightBarButtonItem, titleView=_titleView, hidesBackButton=_hidesBackButton; @synthesize leftBarButtonItem=_leftBarButtonItem, backBarButtonItem=_backBarButtonItem, prompt=_prompt; + (NSSet *)_keyPathsTriggeringUIUpdates { static NSSet * __keyPaths = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ __keyPaths = [[NSSet alloc] initWithObjects:@"title", @"prompt", @"backBarButtonItem", @"leftBarButtonItem", @"rightBarButtonItem", @"titleView", @"hidesBackButton", nil]; }); return __keyPaths; } - (id)initWithTitle:(NSString *)theTitle { if ((self=[super init])) { self.title = theTitle; } return self; } - (void)dealloc { // removes automatic observation [self _setNavigationBar:nil]; [_backBarButtonItem release]; [_leftBarButtonItem release]; [_rightBarButtonItem release]; [_title release]; [_titleView release]; [_prompt release]; [super dealloc]; } - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { if (context != UINavigationItemContext) { if ([[self superclass] instancesRespondToSelector:_cmd]) [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; return; } [[self _navigationBar] _updateNavigationItem:self animated:NO]; } - (void)_setNavigationBar:(UINavigationBar *)navigationBar { // weak reference if (_navigationBar == navigationBar) return; if (_navigationBar != nil && navigationBar == nil) { // remove observation for (NSString * keyPath in [[self class] _keyPathsTriggeringUIUpdates]) { [self removeObserver:self forKeyPath:keyPath]; } } else if (navigationBar != nil) { // observe property changes to notify UI element for (NSString * keyPath in [[self class] _keyPathsTriggeringUIUpdates]) { [self addObserver:self forKeyPath:keyPath options:NSKeyValueObservingOptionNew context:UINavigationItemContext]; } } _navigationBar = navigationBar; } - (UINavigationBar *)_navigationBar { return _navigationBar; } - (void)setLeftBarButtonItem:(UIBarButtonItem *)item animated:(BOOL)animated { if (item != _leftBarButtonItem) { [self willChangeValueForKey: @"leftBarButtonItem"]; [_leftBarButtonItem release]; _leftBarButtonItem = [item retain]; [self didChangeValueForKey: @"leftBarButtonItem"]; } } - (void)setLeftBarButtonItem:(UIBarButtonItem *)item { [self setLeftBarButtonItem:item animated:NO]; } - (void)setRightBarButtonItem:(UIBarButtonItem *)item animated:(BOOL)animated { if (item != _rightBarButtonItem) { [self willChangeValueForKey: @"rightBarButtonItem"]; [_rightBarButtonItem release]; _rightBarButtonItem = [item retain]; [self didChangeValueForKey: @"rightBarButtonItem"]; } } - (void)setRightBarButtonItem:(UIBarButtonItem *)item { [self setRightBarButtonItem:item animated:NO]; } - (void)setHidesBackButton:(BOOL)hidesBackButton animated:(BOOL)animated { [self willChangeValueForKey: @"hidesBackButton"]; _hidesBackButton = hidesBackButton; [self didChangeValueForKey: @"hidesBackButton"]; } - (void)setHidesBackButton:(BOOL)hidesBackButton { [self setHidesBackButton:hidesBackButton animated:NO]; } - (UIBarButtonItem *)backBarButtonItem { if (_backBarButtonItem) { return _backBarButtonItem; } else { return [[[UIBarButtonItem alloc] initWithTitle:(self.title ?: @"Back") style:UIBarButtonItemStylePlain target:nil action:nil] autorelease]; } } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UINibLoading.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @interface NSBundle (UINibLoading) - (NSArray *)loadNibNamed:(NSString *)name owner:(id)owner options:(NSDictionary *)options; // not implemented, but here to avoid some warnings @end @interface NSObject (UINibLoading) - (void)awakeFromNib; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UINibLoading.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UINibLoading.h" @implementation NSBundle (UINibLoading) - (NSArray *)loadNibNamed:(NSString *)name owner:(id)owner options:(NSDictionary *)options { return nil; } @end @implementation NSObject (UINibLoading) - (void)awakeFromNib { } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UINinePartImage.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIImage+UIPrivate.h" @interface UINinePartImage : UIImage { @private NSInteger _leftCapWidth; NSInteger _topCapHeight; } - (id)initWithRepresentations:(NSArray *)reps leftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCapHeight; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UINinePartImage.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UINinePartImage.h" #import "UIImageRep.h" @implementation UINinePartImage - (id)initWithRepresentations:(NSArray *)reps leftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCapHeight { if ((self=[super _initWithRepresentations:reps])) { _leftCapWidth = leftCapWidth; _topCapHeight = topCapHeight; } return self; } - (NSInteger)leftCapWidth { return _leftCapWidth; } - (NSInteger)topCapHeight { return _topCapHeight; } - (void)_drawRepresentation:(UIImageRep *)rep inRect:(CGRect)rect { const CGSize size = self.size; const CGFloat stretchyWidth = (_leftCapWidth < size.width)? 1 : 0; const CGFloat stretchyHeight = (_topCapHeight < size.height)? 1 : 0; const CGFloat bottomCapHeight = size.height - _topCapHeight - stretchyHeight; const CGFloat rightCapWidth = size.width - _leftCapWidth - stretchyWidth; //topLeftCorner [rep drawInRect:CGRectMake(CGRectGetMinX(rect), CGRectGetMinY(rect), _leftCapWidth, _topCapHeight) fromRect:CGRectMake(0, 0, _leftCapWidth, _topCapHeight)]; //topEdgeFill [rep drawInRect:CGRectMake(CGRectGetMinX(rect)+_leftCapWidth, CGRectGetMinY(rect), rect.size.width-rightCapWidth-_leftCapWidth, _topCapHeight) fromRect:CGRectMake(_leftCapWidth, 0, stretchyWidth, _topCapHeight)]; //topRightCorner [rep drawInRect:CGRectMake(CGRectGetMaxX(rect)-rightCapWidth, CGRectGetMinY(rect), rightCapWidth, _topCapHeight) fromRect:CGRectMake(size.width-rightCapWidth, 0, rightCapWidth, _topCapHeight)]; //bottomLeftCorner [rep drawInRect:CGRectMake(CGRectGetMinX(rect), CGRectGetMaxY(rect)-bottomCapHeight, _leftCapWidth, bottomCapHeight) fromRect:CGRectMake(0, size.height-bottomCapHeight, _leftCapWidth, bottomCapHeight)]; //bottomEdgeFill [rep drawInRect:CGRectMake(CGRectGetMinX(rect)+_leftCapWidth, CGRectGetMaxY(rect)-bottomCapHeight, rect.size.width-rightCapWidth-_leftCapWidth, bottomCapHeight) fromRect:CGRectMake(_leftCapWidth, size.height-bottomCapHeight, stretchyWidth, bottomCapHeight)]; //bottomRightCorner [rep drawInRect:CGRectMake(CGRectGetMaxX(rect)-rightCapWidth, CGRectGetMaxY(rect)-bottomCapHeight, rightCapWidth, bottomCapHeight) fromRect:CGRectMake(size.width-rightCapWidth, size.height-bottomCapHeight, rightCapWidth, bottomCapHeight)]; //leftEdgeFill [rep drawInRect:CGRectMake(CGRectGetMinX(rect), CGRectGetMinY(rect)+_topCapHeight, _leftCapWidth, rect.size.height-bottomCapHeight-_topCapHeight) fromRect:CGRectMake(0, _topCapHeight, _leftCapWidth, stretchyHeight)]; //rightEdgeFill [rep drawInRect:CGRectMake(CGRectGetMaxX(rect)-rightCapWidth, CGRectGetMinY(rect)+_topCapHeight, rightCapWidth, rect.size.height-bottomCapHeight-_topCapHeight) fromRect:CGRectMake(size.width-rightCapWidth, _topCapHeight, rightCapWidth, stretchyHeight)]; //centerFill [rep drawInRect:CGRectMake(CGRectGetMinX(rect)+_leftCapWidth, CGRectGetMinY(rect)+_topCapHeight, rect.size.width-rightCapWidth-_leftCapWidth, rect.size.height-bottomCapHeight-_topCapHeight) fromRect:CGRectMake(_leftCapWidth, _topCapHeight, stretchyWidth, stretchyHeight)]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIPageControl.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIControl.h" @interface UIPageControl : UIControl { NSInteger _currentPage; NSInteger _numberOfPages; } @property (nonatomic) NSInteger currentPage; @property (nonatomic) NSInteger numberOfPages; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIPageControl.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIPageControl.h" @implementation UIPageControl @synthesize currentPage=_currentPage, numberOfPages=_numberOfPages; - (void)setCurrentPage:(NSInteger)page { if (page != _currentPage) { _currentPage = MIN(MAX(0,page), self.numberOfPages-1); [self setNeedsDisplay]; } } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIPanGestureRecognizer.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIGestureRecognizer.h" // NOTE: This will only match the scroll gestures on touch input devices. If you also // need classic wheel mice, you have to use UIScrollWheelGestureRecognizer as well. // Additional note: This will not register the system's automatically generated // momentum scroll events - those will come through by way of the classic wheel // recognizer as well. They are handled differently because OSX sends them outside // of the gestureBegin/gestureEnded sequence. This turned out to be somewhat handy // for UIScrollView but it certainly might make using the gesture recognizer in // a standalone setting somewhat more annoying. We'll have to see how it plays out. @interface UIPanGestureRecognizer : UIGestureRecognizer { NSUInteger _maximumNumberOfTouches; NSUInteger _minimumNumberOfTouches; CGPoint _translation; CGPoint _velocity; NSTimeInterval _lastMovementTime; } - (CGPoint)translationInView:(UIView *)view; - (void)setTranslation:(CGPoint)translation inView:(UIView *)view; - (CGPoint)velocityInView:(UIView *)view; @property (nonatomic) NSUInteger maximumNumberOfTouches; @property (nonatomic) NSUInteger minimumNumberOfTouches; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIPanGestureRecognizer.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIPanGestureRecognizer.h" #import "UIGestureRecognizerSubclass.h" #import "UITouch+UIPrivate.h" #import "UIEvent.h" static UITouch *PanTouch(NSSet *touches) { for (UITouch *touch in touches) { if ([touch _gesture] == _UITouchGesturePan) { return touch; } } return nil; } @implementation UIPanGestureRecognizer @synthesize maximumNumberOfTouches=_maximumNumberOfTouches, minimumNumberOfTouches=_minimumNumberOfTouches; - (id)initWithTarget:(id)target action:(SEL)action { if ((self=[super initWithTarget:target action:action])) { _minimumNumberOfTouches = 1; _maximumNumberOfTouches = NSUIntegerMax; _translation = CGPointZero; _velocity = CGPointZero; } return self; } - (CGPoint)translationInView:(UIView *)view { return _translation; } - (void)setTranslation:(CGPoint)translation inView:(UIView *)view { _velocity = CGPointZero; _translation = translation; } - (BOOL)_translate:(CGPoint)delta withEvent:(UIEvent *)event { const NSTimeInterval timeDiff = event.timestamp - _lastMovementTime; if (!CGPointEqualToPoint(delta, CGPointZero) && timeDiff > 0) { _translation.x += delta.x; _translation.y += delta.y; _velocity.x = delta.x / timeDiff; _velocity.y = delta.y / timeDiff; _lastMovementTime = event.timestamp; return YES; } else { return NO; } } - (void)reset { [super reset]; _translation = CGPointZero; _velocity = CGPointZero; } - (CGPoint)velocityInView:(UIView *)view { return _velocity; } - (void)_gesturesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = PanTouch([event touchesForGestureRecognizer:self]); // note that we being the gesture here in the _gesturesMoved:withEvent: method instead of the _gesturesBegan:withEvent: // method because the pan gesture cannot be recognized until the user moves their fingers a bit and OSX won't tag the // gesture as a pan until that movement has actually happened so we have to do the checking here. if (self.state == UIGestureRecognizerStatePossible && touch) { [self setTranslation:[touch _delta] inView:touch.view]; _lastMovementTime = event.timestamp; self.state = UIGestureRecognizerStateBegan; } else if (self.state == UIGestureRecognizerStateBegan || self.state == UIGestureRecognizerStateChanged) { if (touch) { if ([self _translate:[touch _delta] withEvent:event]) { self.state = UIGestureRecognizerStateChanged; } } else { self.state = UIGestureRecognizerStateCancelled; } } } - (void)_gesturesEnded:(NSSet *)touches withEvent:(UIEvent *)event { if (self.state == UIGestureRecognizerStateBegan || self.state == UIGestureRecognizerStateChanged) { UITouch *touch = PanTouch([event touchesForGestureRecognizer:self]); if (touch) { [self _translate:[touch _delta] withEvent:event]; self.state = UIGestureRecognizerStateEnded; } else { self.state = UIGestureRecognizerStateCancelled; } } } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIPasteboard.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @class UIImage, UIColor, NSPasteboard; @interface UIPasteboard : NSObject { NSPasteboard *pasteboard; } + (UIPasteboard *)generalPasteboard; @property (nonatomic,copy) NSURL *URL; @property (nonatomic,copy) NSArray *URLs; @property (nonatomic,copy) NSString *string; @property (nonatomic,copy) NSArray *strings; @property (nonatomic, copy) UIImage *image; @property (nonatomic, copy) NSArray *images; @property (nonatomic, copy) UIColor *color; @property (nonatomic, copy) NSArray *colors; @property (nonatomic, copy) NSArray *items; - (void)addItems:(NSArray *)items; - (void)setData:(NSData *)data forPasteboardType:(NSString *)pasteboardType; - (void)setValue:(id)value forPasteboardType:(NSString *)pasteboardType; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIPasteboard.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIPasteboard.h" #import "UIImageAppKitIntegration.h" #import "UIColorAppKitIntegration.h" #import static id FirstObjectOrNil(NSArray *items) { return ([items count] > 0)? [items objectAtIndex:0] : nil; } static BOOL IsUIPasteboardPropertyListType(id object) { return [object isKindOfClass:[NSString class]] || [object isKindOfClass:[NSArray class]] || [object isKindOfClass:[NSDictionary class]] || [object isKindOfClass:[NSDate class]] || [object isKindOfClass:[NSNumber class]] || [object isKindOfClass:[NSURL class]]; } static NSPasteboardItem *PasteBoardItemWithDictionary(NSDictionary *item) { NSPasteboardItem *pasteboardItem = [[NSPasteboardItem alloc] init]; for (NSString *type in [item allKeys]) { id object = [item objectForKey:type]; if ([object isKindOfClass:[NSData class]]) { // this is a totally evil hack to support animated GIF. // for some reason just copying the data with the kUTTypeGIF to the pasteboard wasn't enough. // after much experimentation it would appear that building an NSAttributed string and embedding // the image into it is the way Safari does it so that pasting into iChat actually works. // this is really stupid. I don't know if this is really the best place for this or if there's a // more general rule for when something should be converted to an attributed string, but this // seemed to be the quickest way to get the job done at the time. Copying raw GIF NSData to the // pasteboard on iOS and tagging it as kUTTypeGIF seems to work just fine in the few places that // accept animated GIFs that I've tested so far on iOS so...... yeah. if (UTTypeEqual((__bridge CFStringRef)type, kUTTypeGIF)) { NSFileWrapper *fileWrapper = [[NSFileWrapper alloc] initRegularFileWithContents:object]; [fileWrapper setPreferredFilename:@"image.gif"]; NSTextAttachment *attachment = [[NSTextAttachment alloc] initWithFileWrapper:fileWrapper]; NSAttributedString *str = [NSAttributedString attributedStringWithAttachment:attachment]; [pasteboardItem setData:[str RTFDFromRange:NSMakeRange(0, [str length]) documentAttributes:@{}] forType:(NSString *)kUTTypeFlatRTFD]; [attachment release]; [fileWrapper release]; } [pasteboardItem setData:object forType:type]; } else if ([object isKindOfClass:[NSURL class]]) { [pasteboardItem setString:[object absoluteString] forType:type]; } else { [pasteboardItem setPropertyList:object forType:type]; } } return [pasteboardItem autorelease]; } @implementation UIPasteboard - (id)initWithPasteboard:(NSPasteboard *)aPasteboard { if ((self=[super init])) { pasteboard = [aPasteboard retain]; } return self; } - (void)dealloc { [pasteboard release]; [super dealloc]; } + (UIPasteboard *)generalPasteboard { static UIPasteboard *aPasteboard = nil; if (!aPasteboard) { aPasteboard = [[UIPasteboard alloc] initWithPasteboard:[NSPasteboard generalPasteboard]]; } return aPasteboard; } - (void)_writeObjects:(NSArray *)objects { [pasteboard clearContents]; [pasteboard writeObjects:objects]; } - (id)_objectsWithClasses:(NSArray *)types { NSDictionary *options = [NSDictionary dictionary]; return [pasteboard readObjectsForClasses:types options:options]; } - (void)setStrings:(NSArray *)strings { [self _writeObjects:strings]; } - (NSArray *)strings { return [self _objectsWithClasses:[NSArray arrayWithObject:[NSString class]]]; } - (void)setString:(NSString *)aString { [self setStrings:[NSArray arrayWithObject:aString]]; } - (NSString *)string { return FirstObjectOrNil([self strings]); } - (void)setURLs:(NSArray *)items { [self _writeObjects:items]; } - (NSArray *)URLs { return [self _objectsWithClasses:[NSArray arrayWithObject:[NSURL class]]]; } - (void)setURL:(NSURL *)aURL { [self setURLs:[NSArray arrayWithObject:aURL]]; } - (NSURL *)URL { return FirstObjectOrNil([self URLs]); } - (void)setImages:(NSArray *)images { NSMutableArray *items = [NSMutableArray arrayWithCapacity:[images count]]; for (UIImage *image in images) { [items addObject:[image NSImage]]; } [self _writeObjects:items]; } - (NSArray *)images { NSArray *rawImages = [self _objectsWithClasses:[NSArray arrayWithObject:[NSImage class]]]; NSMutableArray *images = [NSMutableArray arrayWithCapacity:[rawImages count]]; for (NSImage *image in rawImages) { [images addObject:[[[UIImage alloc] initWithNSImage:image] autorelease]]; } return images; } - (void)setImage:(UIImage *)anImage { [self setImages:[NSArray arrayWithObject:anImage]]; } - (UIImage *)image { return FirstObjectOrNil([self images]); } - (void)setColors:(NSArray *)colors { NSMutableArray *items = [NSMutableArray arrayWithCapacity:[colors count]]; for (UIColor *color in colors) { [items addObject:[color NSColor]]; } [self _writeObjects:items]; } - (NSArray *)colors { NSArray *rawColors = [self _objectsWithClasses:[NSArray arrayWithObject:[NSColor class]]]; NSMutableArray *colors = [NSMutableArray arrayWithCapacity:[rawColors count]]; for (NSColor *color in rawColors) { [colors addObject:[[[UIColor alloc] initWithNSColor:color] autorelease]]; } return colors; } - (void)setColor:(UIColor *)aColor { [self setColors:[NSArray arrayWithObject:aColor]]; } - (UIColor *)color { return FirstObjectOrNil([self colors]); } - (void)addItems:(NSArray *)items { NSMutableArray *objects = [NSMutableArray arrayWithCapacity:[items count]]; for (NSDictionary *item in items) { [objects addObject:PasteBoardItemWithDictionary(item)]; } [pasteboard writeObjects:objects]; } - (void)setItems:(NSArray *)items { [pasteboard clearContents]; [self addItems:items]; } // there's a good chance this won't work correctly for all cases and indeed it's very untested in its current incarnation - (NSArray *)items { NSMutableArray *items = [NSMutableArray arrayWithCapacity:0]; for (NSPasteboardItem *item in [pasteboard pasteboardItems]) { NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithCapacity:0]; for (NSString *type in [item types]) { id object = nil; if (UTTypeConformsTo((__bridge CFStringRef)type, kUTTypeURL)) { object = [NSURL URLWithString:[item stringForType:type]]; } else { object = [item propertyListForType:type] ?: [item dataForType:type]; } if (object) { [dict setObject:object forKey:type]; } } if ([dict count] > 0) { [items addObject:dict]; } } return items; } - (void)setData:(NSData *)data forPasteboardType:(NSString *)pasteboardType { if (data && pasteboardType) { [pasteboard clearContents]; [pasteboard writeObjects:[NSArray arrayWithObject:PasteBoardItemWithDictionary([NSDictionary dictionaryWithObject:data forKey:pasteboardType])]]; } } - (void)setValue:(id)value forPasteboardType:(NSString *)pasteboardType { if (pasteboardType && IsUIPasteboardPropertyListType(value)) { [pasteboard clearContents]; [pasteboard writeObjects:[NSArray arrayWithObject:PasteBoardItemWithDictionary([NSDictionary dictionaryWithObject:value forKey:pasteboardType])]]; } } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIPhotosAlbum.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @class UIImage; @interface UIPhotosAlbum : NSObject + (UIPhotosAlbum *)sharedPhotosAlbum; - (void)writeImage:(UIImage *)image completionTarget:(id)target action:(SEL)action context:(void *)context; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIPhotosAlbum.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIPhotosAlbum.h" #import "UIImage.h" #import @implementation UIPhotosAlbum + (UIPhotosAlbum *)sharedPhotosAlbum { static UIPhotosAlbum *album = nil; if (!album) { album = [[self alloc] init]; } return album; } - (void)_writeImageWithInfo:(NSDictionary *)info { UIImage *image = [info objectForKey:@"image"]; NSError *error = nil; NSSavePanel *panel = [NSSavePanel savePanel]; [panel setAllowedFileTypes:[NSArray arrayWithObject:@"png"]]; if (NSFileHandlingPanelOKButton == [panel runModal] && [panel URL]) { NSData *imageData = UIImagePNGRepresentation(image); if (imageData) { [imageData writeToURL:[panel URL] options:NSDataWritingAtomic error:&error]; } else { error = [NSError errorWithDomain:@"could not generate png image" code:2 userInfo:nil]; } } else { error = [NSError errorWithDomain:@"save panel cancelled" code:1 userInfo:nil]; } id target = [info objectForKey:@"target"]; if (target) { SEL action = NSSelectorFromString([info objectForKey:@"action"]); void *context = [[info objectForKey:@"context"] pointerValue]; NSMethodSignature *signature = [target methodSignatureForSelector:action]; NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; [invocation setSelector:action]; [invocation setArgument:&image atIndex:2]; [invocation setArgument:&error atIndex:3]; [invocation setArgument:&context atIndex:4]; [invocation invokeWithTarget:target]; } } - (void)writeImage:(UIImage *)image completionTarget:(id)target action:(SEL)action context:(void *)context { if (image) { NSMutableDictionary *info = [NSMutableDictionary dictionaryWithCapacity:4]; [info setObject:image forKey:@"image"]; if (target && action) { [info setObject:target forKey:@"target"]; [info setObject:NSStringFromSelector(action) forKey:@"action"]; } if (context) { [info setObject:[NSValue valueWithPointer:context] forKey:@"context"]; } // deferring this partly because the save dialog is modal and partly because I don't think code is going // to expect the target/action to be sent before the save function even returns. [self performSelector:@selector(_writeImageWithInfo:) withObject:info afterDelay:0]; } } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIPickerView.h ================================================ // // UIPickerView.h // UIKit // // Created by Peter Steinberger on 23.03.11. // /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIView.h" @protocol UIPickerViewDataSource, UIPickerViewDelegate; @interface UIPickerView : UIView { __unsafe_unretained id _dataSource; __unsafe_unretained id _delegate; BOOL _showsSelectionIndicator; } @property (nonatomic, assign) id dataSource; @property (nonatomic, assign) id delegate; @property (nonatomic, assign) BOOL showsSelectionIndicator; @property (nonatomic, readonly) NSInteger numberOfComponents; - (NSInteger) numberOfRowsInComponent: (NSInteger) component; // stub - (void) reloadAllComponents; // stub - (void) reloadComponent: (NSInteger) component; // stub - (CGSize) rowSizeForComponent: (NSInteger) component; // stub - (NSInteger) selectedRowInComponent: (NSInteger) component; // stub - (void)selectRow:(NSInteger)row inComponent:(NSInteger)component animated:(BOOL)animated; // stub - (UIView *) viewForRow: (NSInteger) row inComponent: (NSInteger) component; // stub @end @protocol UIPickerViewDataSource @required - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView; - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component; @end @protocol UIPickerViewDelegate @optional - (CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component; - (CGFloat)pickerView:(UIPickerView *)pickerView rowHeightForComponent:(NSInteger)component; - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component; - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view; - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIPickerView.m ================================================ // // UIPickerView.m // UIKit // // Created by Peter Steinberger on 23.03.11. // /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIPickerView.h" @implementation UIPickerView @synthesize showsSelectionIndicator = _showsSelectionIndicator; @synthesize dataSource = _dataSource; @synthesize delegate = _delegate; - (id)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { } return self; } - (void)dealloc { _dataSource = nil; _delegate = nil; [super dealloc]; } - (NSInteger) numberOfComponents { return 0; } - (NSInteger) numberOfRowsInComponent:(NSInteger)component { return 0; } - (void) reloadAllComponents { } - (void) reloadComponent:(NSInteger)component { } - (CGSize) rowSizeForComponent:(NSInteger)component { return CGSizeZero; } - (NSInteger) selectedRowInComponent:(NSInteger)component { return -1; } - (void)selectRow:(NSInteger)row inComponent:(NSInteger)component animated:(BOOL)animated { } - (UIView *) viewForRow:(NSInteger)row inComponent:(NSInteger)component { return nil; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIPinchGestureRecognizer.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIGestureRecognizer.h" @interface UIPinchGestureRecognizer : UIGestureRecognizer { CGFloat _scale; } @property (nonatomic) CGFloat scale; @property (nonatomic, readonly) CGFloat velocity; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIPinchGestureRecognizer.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIPinchGestureRecognizer.h" #import "UIGestureRecognizerSubclass.h" @implementation UIPinchGestureRecognizer @synthesize scale=_scale; - (id)initWithTarget:(id)target action:(SEL)action { if ((self=[super initWithTarget:target action:action])) { _scale = 1; } return self; } - (CGFloat)velocity { return 0; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIPopoverController+UIPrivate.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIPopoverController.h" @interface UIPopoverController (UIPrivate) - (void)_closePopoverWindowIfPossible; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIPopoverController.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import enum { UIPopoverArrowDirectionUp = 1UL << 0, UIPopoverArrowDirectionDown = 1UL << 1, UIPopoverArrowDirectionLeft = 1UL << 2, UIPopoverArrowDirectionRight = 1UL << 3, UIPopoverArrowDirectionAny = UIPopoverArrowDirectionUp | UIPopoverArrowDirectionDown | UIPopoverArrowDirectionLeft | UIPopoverArrowDirectionRight, UIPopoverArrowDirectionUnknown = NSUIntegerMax }; typedef NSUInteger UIPopoverArrowDirection; @class UIView, UIViewController, UIPopoverController, UIBarButtonItem, UIPopoverView; @protocol UIPopoverControllerDelegate @optional - (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController; - (BOOL)popoverControllerShouldDismissPopover:(UIPopoverController *)popoverController; @end @interface UIPopoverController : NSObject { @private UIViewController *_contentViewController; NSArray *_passthroughViews; UIPopoverArrowDirection _popoverArrowDirection; UIPopoverView *_popoverView; id _popoverWindow; id _overlayWindow; BOOL _isDismissing; __unsafe_unretained id _delegate; struct { unsigned popoverControllerDidDismissPopover : 1; unsigned popoverControllerShouldDismissPopover : 1; } _delegateHas; } - (id)initWithContentViewController:(UIViewController *)viewController; - (void)setContentViewController:(UIViewController *)controller animated:(BOOL)animated; - (void)presentPopoverFromRect:(CGRect)rect inView:(UIView *)view permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated; - (void)presentPopoverFromBarButtonItem:(UIBarButtonItem *)item permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated; - (void)dismissPopoverAnimated:(BOOL)animated; @property (nonatomic, assign) id delegate; @property (nonatomic, strong) UIViewController *contentViewController; @property (nonatomic, readonly, getter=isPopoverVisible) BOOL popoverVisible; @property (nonatomic, copy) NSArray *passthroughViews; @property (nonatomic, readonly) UIPopoverArrowDirection popoverArrowDirection; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIPopoverController.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIPopoverController+UIPrivate.h" #import "UIViewController.h" #import "UIWindow.h" #import "UIScreen+UIPrivate.h" #import "UIScreenAppKitIntegration.h" #import "UIKitView.h" #import "UITouch.h" #import "UIApplication+UIPrivate.h" #import "UIPopoverView.h" #import "UIPopoverNSWindow.h" #import "UIPopoverOverlayNSView.h" static BOOL SizeIsLessThanOrEqualSize(NSSize size1, NSSize size2) { return (size1.width <= size2.width) && (size1.height <= size2.height); } static NSPoint PopoverWindowOrigin(NSWindow *inWindow, NSRect fromRect, NSSize popoverSize, UIPopoverArrowDirection arrowDirections, NSPoint *pointTo, UIPopoverArrowDirection *arrowDirection) { // 1) define a set of possible quads around fromRect that the popover could appear in // 2) eliminate quads based on arrow direction restrictions and sizes // 3) the first quad that is large enough "wins" NSRect screenRect = [[inWindow screen] visibleFrame]; NSRect bottomQuad = NSMakeRect(screenRect.origin.x, screenRect.origin.y, screenRect.size.width, fromRect.origin.y-screenRect.origin.y); NSRect topQuad = NSMakeRect(screenRect.origin.x, fromRect.origin.y+fromRect.size.height, screenRect.size.width, screenRect.size.height-fromRect.origin.y-fromRect.size.height-screenRect.origin.y); NSRect leftQuad = NSMakeRect(screenRect.origin.x, screenRect.origin.y, fromRect.origin.x-screenRect.origin.x, screenRect.size.height-screenRect.origin.y); NSRect rightQuad = NSMakeRect(fromRect.origin.x+fromRect.size.width, screenRect.origin.y, screenRect.size.width-fromRect.origin.x-fromRect.size.width-screenRect.origin.x, screenRect.size.height-screenRect.origin.y); pointTo->x = fromRect.origin.x+(fromRect.size.width/2.f); pointTo->y = fromRect.origin.y+(fromRect.size.height/2.f); NSPoint origin; origin.x = fromRect.origin.x + (fromRect.size.width/2.f) - (popoverSize.width/2.f); origin.y = fromRect.origin.y + (fromRect.size.height/2.f) - (popoverSize.height/2.f); const CGFloat minimumPadding = 40; const BOOL allowTopOrBottom = (pointTo->x >= NSMinX(screenRect)+minimumPadding && pointTo->x <= NSMaxX(screenRect)-minimumPadding); const BOOL allowLeftOrRight = (pointTo->y >= NSMinY(screenRect)+minimumPadding && pointTo->y <= NSMaxY(screenRect)-minimumPadding); const BOOL allowTopQuad = ((arrowDirections & UIPopoverArrowDirectionDown) != 0) && topQuad.size.width > 0 && topQuad.size.height > 0 && allowTopOrBottom; const BOOL allowBottomQuad = ((arrowDirections & UIPopoverArrowDirectionUp) != 0) && bottomQuad.size.width > 0 && bottomQuad.size.height > 0 && allowTopOrBottom; const BOOL allowLeftQuad = ((arrowDirections & UIPopoverArrowDirectionRight) != 0) && leftQuad.size.width > 0 && leftQuad.size.height > 0 && allowLeftOrRight; const BOOL allowRightQuad = ((arrowDirections & UIPopoverArrowDirectionLeft) != 0) && rightQuad.size.width > 0 && rightQuad.size.height > 0 && allowLeftOrRight; const CGFloat arrowPadding = 8; // the arrow images are slightly larger to account for shadows, but the arrow point needs to be up against the rect exactly so this helps with that if (allowBottomQuad && SizeIsLessThanOrEqualSize(popoverSize,bottomQuad.size)) { pointTo->y = fromRect.origin.y; origin.y = fromRect.origin.y - popoverSize.height + arrowPadding; *arrowDirection = UIPopoverArrowDirectionUp; } else if (allowRightQuad && SizeIsLessThanOrEqualSize(popoverSize,rightQuad.size)) { pointTo->x = fromRect.origin.x + fromRect.size.width; origin.x = pointTo->x - arrowPadding; *arrowDirection = UIPopoverArrowDirectionLeft; } else if (allowLeftQuad && SizeIsLessThanOrEqualSize(popoverSize,leftQuad.size)) { pointTo->x = fromRect.origin.x; origin.x = fromRect.origin.x - popoverSize.width + arrowPadding; *arrowDirection = UIPopoverArrowDirectionRight; } else if (allowTopQuad && SizeIsLessThanOrEqualSize(popoverSize,topQuad.size)) { pointTo->y = fromRect.origin.y + fromRect.size.height; origin.y = pointTo->y - arrowPadding; *arrowDirection = UIPopoverArrowDirectionDown; } else { *arrowDirection = UIPopoverArrowDirectionUnknown; } NSRect windowRect; windowRect.origin = origin; windowRect.size = popoverSize; if (NSMaxX(windowRect) > NSMaxX(screenRect)) { windowRect.origin.x = NSMaxX(screenRect) - popoverSize.width; } if (NSMinX(windowRect) < NSMinX(screenRect)) { windowRect.origin.x = NSMinX(screenRect); } if (NSMaxY(windowRect) > NSMaxY(screenRect)) { windowRect.origin.y = NSMaxY(screenRect) - popoverSize.height; } if (NSMinY(windowRect) < NSMinY(screenRect)) { windowRect.origin.y = NSMinY(screenRect); } windowRect.origin.x = roundf(windowRect.origin.x); windowRect.origin.y = roundf(windowRect.origin.y); return windowRect.origin; } @interface UIPopoverController () - (void)_destroyPopover; @end @implementation UIPopoverController @synthesize delegate=_delegate, contentViewController=_contentViewController, passthroughViews=_passthroughViews; @synthesize popoverArrowDirection=_popoverArrowDirection; - (id)init { if ((self=[super init])) { _popoverArrowDirection = UIPopoverArrowDirectionUnknown; } return self; } - (id)initWithContentViewController:(UIViewController *)viewController { if ((self=[self init])) { self.contentViewController = viewController; } return self; } - (void)dealloc { [self _destroyPopover]; [_passthroughViews release]; [_contentViewController release]; [super dealloc]; } - (void)setDelegate:(id)newDelegate { _delegate = newDelegate; _delegateHas.popoverControllerDidDismissPopover = [_delegate respondsToSelector:@selector(popoverControllerDidDismissPopover:)]; _delegateHas.popoverControllerShouldDismissPopover = [_delegate respondsToSelector:@selector(popoverControllerShouldDismissPopover:)]; } - (void)setContentViewController:(UIViewController *)controller animated:(BOOL)animated { if (controller != _contentViewController) { if ([self isPopoverVisible]) { [_popoverView setContentView:controller.view animated:animated]; } [_contentViewController release]; _contentViewController = [controller retain]; } } - (void)setContentViewController:(UIViewController *)viewController { [self setContentViewController:viewController animated:NO]; } - (void)presentPopoverFromRect:(CGRect)rect inView:(UIView *)view permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated { assert(_isDismissing == NO); assert(view != nil); assert(arrowDirections != UIPopoverArrowDirectionUnknown); assert(!CGRectIsNull(rect)); assert(!CGRectEqualToRect(rect,CGRectZero)); assert([[view.window.screen UIKitView] window] != nil); NSWindow *viewNSWindow = [[view.window.screen UIKitView] window]; // only create new stuff if the popover isn't already visible if (![self isPopoverVisible]) { assert(_overlayWindow == nil); assert(_popoverView == nil); assert(_popoverWindow == nil); // build an overlay window which will capture any clicks on the main window the popover is being presented from and then dismiss it. // this overlay can also be used to implement the pass-through views of the popover, but I'm not going to do that right now since // we don't need it. attach the overlay window to the "main" window. NSRect windowFrame = [viewNSWindow frame]; NSRect overlayContentRect = NSMakeRect(0,0,windowFrame.size.width,windowFrame.size.height); UIPopoverOverlayNSView *popoverOverlayNSView = [[UIPopoverOverlayNSView alloc] initWithFrame:overlayContentRect popoverController:self]; _overlayWindow = [[NSWindow alloc] initWithContentRect:overlayContentRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES]; [_overlayWindow setContentView:popoverOverlayNSView]; [_overlayWindow setIgnoresMouseEvents:NO]; [_overlayWindow setOpaque:NO]; [(NSWindow *)_overlayWindow setBackgroundColor:[NSColor clearColor]]; [_overlayWindow setFrameOrigin:windowFrame.origin]; [viewNSWindow addChildWindow:_overlayWindow ordered:NSWindowAbove]; // now build the actual popover view which represents the popover's chrome, and since it's a UIView, we need to build a UIKitView // as well to put it in our NSWindow... _popoverView = [[UIPopoverView alloc] initWithContentView:_contentViewController.view size:_contentViewController.contentSizeForViewInPopover]; // this prevents a visible flash from sometimes occuring due to the fact that the window is created and added as a child before it has the // proper origin set. this means it it ends up flashing at the bottom left corner of the screen sometimes before it // gets down farther in this method where the actual origin is calculated and set. since the window is transparent, simply setting the UIView // hidden gets around the problem since you then can't see any of the actual content that's in the window :) _popoverView.hidden = YES; UIKitView *hostingView = [(UIKitView *)[UIKitView alloc] initWithFrame:NSRectFromCGRect([_popoverView bounds])]; [[hostingView UIScreen] _setPopoverController:self]; [[hostingView UIWindow] addSubview:_popoverView]; // now finally make the actual popover window itself and attach it to the overlay window _popoverWindow = [[UIPopoverNSWindow alloc] initWithContentRect:[hostingView bounds] styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES]; [(UIPopoverNSWindow *)_popoverWindow setContentView:hostingView]; [(UIPopoverNSWindow *)_popoverWindow setPopoverController:self]; [(UIPopoverNSWindow *)_popoverWindow setOpaque:NO]; [(UIPopoverNSWindow *)_popoverWindow setBackgroundColor:[NSColor clearColor]]; [_overlayWindow addChildWindow:_popoverWindow ordered:NSWindowAbove]; [(UIPopoverNSWindow *)_popoverWindow makeFirstResponder:hostingView]; [hostingView release]; [popoverOverlayNSView release]; } // cancel current touches (if any) to prevent the main window from losing track of events (such as if the user was holding down the mouse // button and a timer triggered the appearance of this popover. the window would possibly then not receive the mouseUp depending on how // all this works out... I first ran into this problem with NSMenus. A NSWindow is a bit different, but I think this makes sense here // too so premptively doing it to avoid potential problems.) [[UIApplication sharedApplication] _cancelTouches]; // now position the popover window according to the passed in parameters. CGRect windowRect = [view convertRect:rect toView:nil]; CGRect screenRect = [view.window convertRect:windowRect toWindow:nil]; CGRect desktopScreenRect = [view.window.screen convertRect:screenRect toScreen:nil]; NSPoint pointTo = NSMakePoint(0,0); // finally, let's show it! [_popoverWindow setFrameOrigin:PopoverWindowOrigin(_overlayWindow, NSRectFromCGRect(desktopScreenRect), NSSizeFromCGSize(_popoverView.frame.size), arrowDirections, &pointTo, &_popoverArrowDirection)]; _popoverView.hidden = NO; [_popoverWindow makeKeyWindow]; // the window has to be visible before these coordinate conversions will work correctly (otherwise the UIScreen isn't attached to anything // and blah blah blah...) // finally, set the arrow position so it points to the right place and looks all purty. if (_popoverArrowDirection != UIPopoverArrowDirectionUnknown) { CGPoint screenPointTo = [view.window.screen convertPoint:NSPointToCGPoint(pointTo) fromScreen:nil]; CGPoint windowPointTo = [view.window convertPoint:screenPointTo fromWindow:nil]; CGPoint viewPointTo = [view convertPoint:windowPointTo fromView:nil]; [_popoverView pointTo:viewPointTo inView:view]; } if (animated) { _popoverView.transform = CGAffineTransformMakeScale(0.98f,0.98f); _popoverView.alpha = 0.4f; [UIView animateWithDuration:0.08 animations:^(void) { _popoverView.transform = CGAffineTransformIdentity; }]; [UIView animateWithDuration:0.1 animations:^(void) { _popoverView.alpha = 1.f; }]; } } - (void)presentPopoverFromBarButtonItem:(UIBarButtonItem *)item permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated { } - (BOOL)isPopoverVisible { return (_popoverView || _popoverWindow || _overlayWindow); } - (void)_destroyPopover { NSWindow *parentWindow = [[_overlayWindow parentWindow] retain]; [_overlayWindow removeChildWindow:_popoverWindow]; [parentWindow removeChildWindow:_overlayWindow]; [_popoverView release]; _popoverView = nil; [_popoverWindow close]; _popoverWindow = nil; [_overlayWindow close]; _overlayWindow = nil; _popoverArrowDirection = UIPopoverArrowDirectionUnknown; [parentWindow makeKeyAndOrderFront:self]; [parentWindow release]; _isDismissing = NO; } - (void)dismissPopoverAnimated:(BOOL)animated { if (!_isDismissing && [self isPopoverVisible]) { _isDismissing = YES; [UIView animateWithDuration:animated? 0.2 : 0 animations:^(void) { _popoverView.alpha = 0; } completion:^(BOOL finished) { [self _destroyPopover]; }]; } } - (void)_closePopoverWindowIfPossible { if (!_isDismissing && [self isPopoverVisible]) { const BOOL shouldDismiss = _delegateHas.popoverControllerShouldDismissPopover? [_delegate popoverControllerShouldDismissPopover:self] : YES; if (shouldDismiss) { [self dismissPopoverAnimated:YES]; if (_delegateHas.popoverControllerDidDismissPopover) { [_delegate popoverControllerDidDismissPopover:self]; } } } } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIPopoverNSWindow.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @class UIPopoverController; @interface UIPopoverNSWindow : NSWindow { __unsafe_unretained UIPopoverController *_popoverController; } - (void)setPopoverController:(UIPopoverController *)controller; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIPopoverNSWindow.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIPopoverNSWindow.h" #import "UIPopoverController+UIPrivate.h" @implementation UIPopoverNSWindow - (void)setPopoverController:(UIPopoverController *)controller { _popoverController = controller; } - (BOOL)canBecomeKeyWindow { return YES; } - (void)cancelOperation:(id)sender { [_popoverController _closePopoverWindowIfPossible]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIPopoverOverlayNSView.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @class UIPopoverController; @interface UIPopoverOverlayNSView : NSView { UIPopoverController *_popoverController; } - (id)initWithFrame:(NSRect)frame popoverController:(UIPopoverController *)controller; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIPopoverOverlayNSView.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIPopoverOverlayNSView.h" #import "UIPopoverController+UIPrivate.h" @implementation UIPopoverOverlayNSView - (id)initWithFrame:(NSRect)frame popoverController:(UIPopoverController *)controller { if ((self=[super initWithFrame:frame])) { _popoverController = controller; } return self; } - (BOOL)acceptsFirstMouse:(NSEvent *)theEvent { return YES; } - (BOOL)canBecomeKeyView { return NO; } - (void)mouseDown:(NSEvent *)theEvent { [_popoverController _closePopoverWindowIfPossible]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIPopoverView.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIView.h" @class UIImageView; @interface UIPopoverView : UIView { UIImageView *_backgroundView; UIImageView *_arrowView; UIView *_contentView; UIView *_contentContainerView; } - (id)initWithContentView:(UIView *)aView size:(CGSize)aSize; - (void)pointTo:(CGPoint)point inView:(UIView *)view; - (void)setContentView:(UIView *)aView animated:(BOOL)animated; - (void)setContentSize:(CGSize)aSize animated:(BOOL)animated; @property (nonatomic, strong) UIView *contentView; @property (nonatomic, assign) CGSize contentSize; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIPopoverView.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIPopoverView.h" #import "UIImageView.h" #import "UIImage+UIPrivate.h" #import typedef struct { CGPoint from; CGPoint to; } LineSegment; static LineSegment LineSegmentMake(CGPoint from, CGPoint to) { LineSegment segment; segment.from = from; segment.to = to; return segment; } static BOOL LineSegmentsIntersect(LineSegment line1, LineSegment line2, CGPoint *intersection) { /* E = B-A = ( Bx-Ax, By-Ay ) F = D-C = ( Dx-Cx, Dy-Cy ) P = ( -Ey, Ex ) h = ( (A-C) * P ) / ( F * P ) I = C + F*h */ const CGPoint A = line1.from; const CGPoint B = line1.to; const CGPoint C = line2.from; const CGPoint D = line2.to; const CGPoint E = CGPointMake(B.x-A.x, B.y-A.y); const CGPoint F = CGPointMake(D.x-C.x, D.y-C.y); const CGPoint P = CGPointMake(-E.y, E.x); const CGPoint AC = CGPointMake(A.x-C.x, A.y-C.y); const CGFloat h2 = F.x * P.x + F.y * P.y; // if h2 is 0, the lines are parallel if (h2 != 0) { const CGFloat h1 = AC.x * P.x + AC.y * P.y; const CGFloat h = h1 / h2; // if h is exactly 0 or 1, the lines touched on the end - we won't consider that an intersection if (h > 0 && h < 1) { if (intersection) { const CGPoint I = CGPointMake(C.x+F.x*h, C.y+F.y*h); intersection->x = I.x; intersection->y = I.y; } return YES; } } return NO; } static CGFloat DistanceBetweenTwoPoints(CGPoint A, CGPoint B) { CGFloat a = B.x - A.x; CGFloat b = B.y - A.y; return sqrtf((a*a) + (b*b)); } @implementation UIPopoverView @synthesize contentView=_contentView; + (UIEdgeInsets)insetForArrows { return UIEdgeInsetsMake(17,12,8,12); } + (CGRect)backgroundRectForBounds:(CGRect)bounds { return UIEdgeInsetsInsetRect(bounds, [self insetForArrows]); } + (CGRect)contentRectForBounds:(CGRect)bounds withNavigationBar:(BOOL)hasNavBar { const CGFloat navBarOffset = hasNavBar? 32 : 0; return UIEdgeInsetsInsetRect(CGRectMake(14,9+navBarOffset,bounds.size.width-28,bounds.size.height-28-navBarOffset), [self insetForArrows]); } + (CGSize)frameSizeForContentSize:(CGSize)contentSize withNavigationBar:(BOOL)hasNavBar { UIEdgeInsets insets = [self insetForArrows]; CGSize frameSize; frameSize.width = contentSize.width + 28 + insets.left + insets.right; frameSize.height = contentSize.height + 28 + (hasNavBar? 32 : 0) + insets.top + insets.bottom; return frameSize; } - (id)initWithContentView:(UIView *)aView size:(CGSize)aSize { if ((self=[super initWithFrame:CGRectMake(0,0,320,480)])) { _contentView = [aView retain]; UIImage *backgroundImage = [UIImage _popoverBackgroundImage]; _backgroundView = [[UIImageView alloc] initWithImage:backgroundImage]; _arrowView = [[UIImageView alloc] initWithFrame:CGRectZero]; _contentContainerView = [[UIView alloc] init]; _contentContainerView.layer.cornerRadius = 3; _contentContainerView.clipsToBounds = YES; [self addSubview:_backgroundView]; [self addSubview:_arrowView]; [self addSubview:_contentContainerView]; [_contentContainerView addSubview:_contentView]; self.contentSize = aSize; } return self; } - (void)dealloc { [_backgroundView release]; [_arrowView release]; [_contentContainerView release]; [_contentView release]; [super dealloc]; } - (void)layoutSubviews { [super layoutSubviews]; const CGRect bounds = self.bounds; _backgroundView.frame = [[self class] backgroundRectForBounds:bounds]; _contentContainerView.frame = [[self class] contentRectForBounds:bounds withNavigationBar:NO]; _contentView.frame = _contentContainerView.bounds; } - (void)pointTo:(CGPoint)point inView:(UIView *)view { // This math here is excessive. I went through a lot of effort because of an earlier idea I had about how to // get this stuff to point correctly. I'm reasonably sure that wasn't really necessary, but I'm going to leave it // here for now. It's neat stuff.. :) It takes an origin point within the popover view and then creates a line // between it and the destination point. It then finds where that line intersects with the sides of the popover // frame and uses that intersection point as the place to put the arrow image. There is also logic here to clamp // the position of the arrow images so that they don't extend beyond the popover's chrome. Cool, but excessive. :) const CGRect myBounds = self.bounds; // arrowPoint and myCenter should both be in self's coordinate space const CGPoint arrowPoint = [self convertPoint:point fromView:view]; CGPoint myCenter = CGPointMake(CGRectGetMidX(myBounds), CGRectGetMidY(myBounds)); // inset the bounds so that the bounding lines are at the center points of the arrow images const CGRect bounds = CGRectInset(myBounds, 11, 11); // check to see if the arrowPoint has any components that fall on lines which intersect the popover view itself. // if it does, then adjust myCenter accordingly - this makes the algorithm prefer a straight line whenever possible // which should ultimately look better - note that this was added well after all this complex math and is the // single simple thing which helps render most of the complex math moot. Sometimes the easy thing to do is not // the obvious thing if you're in the wrong frame of mind at the time. :/ if (arrowPoint.x > CGRectGetMinX(bounds) && arrowPoint.x < CGRectGetMaxX(bounds)) { myCenter.x = arrowPoint.x; } if (arrowPoint.y > CGRectGetMinY(bounds) && arrowPoint.y < CGRectGetMaxY(bounds)) { myCenter.y = arrowPoint.y; } const CGPoint topRight = CGPointMake(bounds.origin.x+bounds.size.width, bounds.origin.y); const CGPoint bottomLeft = CGPointMake(bounds.origin.x, bounds.origin.y+bounds.size.height); const CGPoint bottomRight = CGPointMake(bounds.origin.x+bounds.size.width, bounds.origin.y+bounds.size.height); const LineSegment arrowLine = LineSegmentMake(arrowPoint, myCenter); const LineSegment rightSide = LineSegmentMake(topRight, bottomRight); const LineSegment topSide = LineSegmentMake(bounds.origin, topRight); const LineSegment bottomSide = LineSegmentMake(bottomLeft, bottomRight); const LineSegment leftSide = LineSegmentMake(bounds.origin, bottomLeft); CGPoint intersection = CGPointZero; CGPoint bestIntersection = CGPointZero; CGFloat bestDistance = CGFLOAT_MAX; CGRectEdge closestEdge = CGRectMinXEdge; if (LineSegmentsIntersect(arrowLine, rightSide, &intersection)) { const CGFloat distance = DistanceBetweenTwoPoints(intersection, arrowPoint); if (distance < bestDistance) { bestDistance = distance; closestEdge = CGRectMaxXEdge; bestIntersection = intersection; } } if (LineSegmentsIntersect(arrowLine, topSide, &intersection)) { const CGFloat distance = DistanceBetweenTwoPoints(intersection, arrowPoint); if (distance < bestDistance) { bestDistance = distance; closestEdge = CGRectMinYEdge; bestIntersection = intersection; } } if (LineSegmentsIntersect(arrowLine, bottomSide, &intersection)) { const CGFloat distance = DistanceBetweenTwoPoints(intersection, arrowPoint); if (distance < bestDistance) { bestDistance = distance; closestEdge = CGRectMaxYEdge; bestIntersection = intersection; } } if (LineSegmentsIntersect(arrowLine, leftSide, &intersection)) { const CGFloat distance = DistanceBetweenTwoPoints(intersection, arrowPoint); if (distance < bestDistance) { //bestDistance = distance; -- commented out to avoid a harmless analyzer warning closestEdge = CGRectMinXEdge; bestIntersection = intersection; } } BOOL clampVertical = NO; if (closestEdge == CGRectMaxXEdge) { // right side _arrowView.image = [UIImage _rightPopoverArrowImage]; clampVertical = YES; } else if (closestEdge == CGRectMaxYEdge) { // bottom side _arrowView.image = [UIImage _bottomPopoverArrowImage]; clampVertical = NO; } else if (closestEdge == CGRectMinYEdge) { // top side _arrowView.image = [UIImage _topPopoverArrowImage]; clampVertical = NO; } else { // left side _arrowView.image = [UIImage _leftPopoverArrowImage]; clampVertical = YES; } // this will clamp where the arrow is positioned so that it doesn't slide off the edges of // the popover and look dumb and disconnected. const CGRect innerBounds = CGRectInset(myBounds, 42, 42); if (clampVertical) { if (bestIntersection.y < innerBounds.origin.y) { bestIntersection.y = innerBounds.origin.y; } else if (bestIntersection.y > innerBounds.origin.y+innerBounds.size.height) { bestIntersection.y = innerBounds.origin.y+innerBounds.size.height; } } else { if (bestIntersection.x < innerBounds.origin.x) { bestIntersection.x = innerBounds.origin.x; } else if (bestIntersection.x > innerBounds.origin.x+innerBounds.size.width) { bestIntersection.x = innerBounds.origin.x+innerBounds.size.width; } } [_arrowView sizeToFit]; _arrowView.center = bestIntersection; CGRect arrowFrame = _arrowView.frame; arrowFrame.origin.x = roundf(arrowFrame.origin.x); arrowFrame.origin.y = roundf(arrowFrame.origin.y); _arrowView.frame = arrowFrame; } - (void)setContentView:(UIView *)aView animated:(BOOL)animated { if (aView != _contentView) { [_contentView removeFromSuperview]; [_contentView release]; _contentView = [aView retain]; [self addSubview:_contentView]; } } - (void)setContentView:(UIView *)aView { [self setContentView:aView animated:NO]; } - (void)setContentSize:(CGSize)aSize animated:(BOOL)animated { CGRect frame = self.frame; frame.size = [[self class] frameSizeForContentSize:aSize withNavigationBar:NO]; [UIView animateWithDuration:animated? 0.2 : 0 animations:^(void) { self.frame = frame; }]; } - (CGSize)contentSize { return _contentContainerView.bounds.size; } - (void)setContentSize:(CGSize)newSize { [self setContentSize:newSize animated:NO]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIProgressView.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIView.h" typedef enum { UIProgressViewStyleDefault, UIProgressViewStyleBar, } UIProgressViewStyle; @interface UIProgressView : UIView { UIProgressViewStyle _progressViewStyle; float _progress; } - (id)initWithProgressViewStyle:(UIProgressViewStyle)style; @property (nonatomic) UIProgressViewStyle progressViewStyle; @property (nonatomic) float progress; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIProgressView.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIProgressView.h" @implementation UIProgressView @synthesize progressViewStyle=_progressViewStyle, progress=_progress; - (id)initWithProgressViewStyle:(UIProgressViewStyle)style { if ((self=[super initWithFrame:CGRectMake(0,0,0,0)])) { _progressViewStyle = style; } return self; } - (void)setProgressViewStyle:(UIProgressViewStyle)style { if (style != _progressViewStyle) { _progressViewStyle = style; [self setNeedsDisplay]; } } - (void)setProgress:(float)p { if (p != _progress) { _progress = MIN(1,MAX(0,p)); [self setNeedsDisplay]; } } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIResponder.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIEvent.h" @interface UIResponder : NSObject - (UIResponder *)nextResponder; - (BOOL)isFirstResponder; - (BOOL)canBecomeFirstResponder; - (BOOL)becomeFirstResponder; - (BOOL)canResignFirstResponder; - (BOOL)resignFirstResponder; - (BOOL)canPerformAction:(SEL)action withSender:(id)sender; - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event; - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event; - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event; - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event; - (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event; - (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event; - (void)motionCancelled:(UIEventSubtype)motion withEvent:(UIEvent *)event; @property (nonatomic, readonly, strong) UIView *inputAccessoryView; @property (nonatomic, readonly, strong) UIView *inputView; @property (nonatomic, readonly) NSUndoManager *undoManager; @end @interface NSObject (UIResponderStandardEditActions) - (void)copy:(id)sender; - (void)cut:(id)sender; - (void)delete:(id)sender; - (void)paste:(id)sender; - (void)select:(id)sender; - (void)selectAll:(id)sender; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIResponder.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIResponder.h" #import "UIWindow+UIPrivate.h" #import "UIInputController.h" @implementation UIResponder - (UIResponder *)nextResponder { return nil; } - (UIWindow *)_responderWindow { if ([self isKindOfClass:[UIView class]]) { return [(UIView *)self window]; } else { return [[self nextResponder] _responderWindow]; } } - (BOOL)isFirstResponder { return ([[self _responderWindow] _firstResponder] == self); } - (BOOL)canBecomeFirstResponder { return NO; } - (BOOL)becomeFirstResponder { if ([self isFirstResponder]) { return YES; } else { UIWindow *window = [self _responderWindow]; UIResponder *firstResponder = [window _firstResponder]; if (window && [self canBecomeFirstResponder]) { BOOL didResign = NO; if (firstResponder && [firstResponder canResignFirstResponder]) { didResign = [firstResponder resignFirstResponder]; } else { didResign = YES; } if (didResign) { [window makeKeyWindow]; // not sure about this :/ [window _setFirstResponder:self]; // I have no idea how iOS manages this stuff, but here I'm modeling UIMenuController since it also uses the first // responder to do its work. My thinking is that if there were an on-screen keyboard, something here could detect // if self conforms to UITextInputTraits and UIKeyInput and/or UITextInput and then build/fetch the correct keyboard // and assign that to the inputView property which would seperate the keyboard and inputs themselves from the stuff // that actually displays them on screen. Of course on the Mac we don't need an on-screen keyboard, but there's // possibly an argument to be made for supporting custom inputViews anyway. UIInputController *controller = [UIInputController sharedInputController]; controller.inputAccessoryView = self.inputAccessoryView; controller.inputView = self.inputView; [controller setInputVisible:YES animated:YES]; return YES; } } return NO; } } - (BOOL)canResignFirstResponder { return YES; } - (BOOL)resignFirstResponder { if ([self isFirstResponder]) { [[self _responderWindow] _setFirstResponder:nil]; [[UIInputController sharedInputController] setInputVisible:NO animated:YES]; } return YES; } - (BOOL)canPerformAction:(SEL)action withSender:(id)sender { if ([[self class] instancesRespondToSelector:action]) { return YES; } else { return [[self nextResponder] canPerformAction:action withSender:sender]; } } - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [[self nextResponder] touchesBegan:touches withEvent:event]; } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { [[self nextResponder] touchesMoved:touches withEvent:event]; } - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { [[self nextResponder] touchesEnded:touches withEvent:event]; } - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { [[self nextResponder] touchesCancelled:touches withEvent:event]; } - (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event {} - (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event {} - (void)motionCancelled:(UIEventSubtype)motion withEvent:(UIEvent *)event {} - (UIView *)inputAccessoryView { return nil; } - (UIView *)inputView { return nil; } - (NSUndoManager *)undoManager { return [[self nextResponder] undoManager]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIResponderAppKitIntegration.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIResponder.h" @class UIKey; @interface UIResponder (AppKitIntegration) // This message is sent up the responder chain so that views behind other views can make use of the scroll wheel (such as UIScrollView). - (void)scrollWheelMoved:(CGPoint)delta withEvent:(UIEvent *)event; // This is sent up the responder chain when the app gets a rightMouseDown-like event from OSX. There is no rightMouseDragged or rightMouseUp. - (void)rightClick:(UITouch *)touch withEvent:(UIEvent *)event; // This message is sent up (down?) the responder chain. You may get these often - especially when the mouse moves over a view that has a lot // of smaller subviews in it as the messages will be sent each time the view under the cursor changes. These only happen during normal mouse // movement - not when clicking, click-dragging, etc so it won't happen in all possible cases that might maybe make sense. Also, due to the // bolted-on nature of this, I'm not entirely convinced it is delivered from the best spot - but in practice, it'll probably be okay. // NOTE: You might get this message twice since the message is sent both to the view being left and the one being exited and they could // ultimately share the same superview or controller or something. // If the mouse came in from outside the hosting UIKitView, the enteredView is nil. If the mouse left the UIKitView, the exitedView is nil. - (void)mouseExitedView:(UIView *)exited enteredView:(UIView *)entered withEvent:(UIEvent *)event; // This passed along the responder chain like everything else. - (void)mouseMoved:(CGPoint)delta withEvent:(UIEvent *)event; // Return an NSCursor if you want to modify it or nil to use the default arrow. Follows responder chain. - (id)mouseCursorForEvent:(UIEvent *)event; // return an NSCursor if you want to modify it, return nil to use default // This is a rough guess as to what might be coming in the future with UIKit. I suspect it'll be similar but perhaps more detailed. UIKey // may or may not exist, etc. This will work for now in case it is needed. This is only triggered by keyDown: events and is not extensively // implemented or tested at this point. This is sent to the firstResponder in the keyWindow. // Note, that the UIEvent here will be an empty non-touch one and has no real purpose in the present implementation :) - (void)keyPressed:(UIKey *)key withEvent:(UIEvent *)event; @end @interface NSObject (UIResponderAppKitIntegrationKeyboardActions) // This is triggered from AppKit's cancelOperation: so it should be sent in largely the same circumstances. Generally you can think of it as mapping // to the ESC key, but CMD-. (period) also maps to it. - (void)cancel:(id)sender; // This is mapped to CMD-Return and Enter and does not come from AppKit since it has no such convention as far as I've found. However it seemed like // a useful thing to define, really, so that's what I'm doing. :) - (void)commit:(id)sender; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIResponderAppKitIntegration.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIResponderAppKitIntegration.h" #import "UIEvent+UIPrivate.h" @implementation UIResponder (AppKitIntegration) - (void)scrollWheelMoved:(CGPoint)delta withEvent:(UIEvent *)event { [[self nextResponder] scrollWheelMoved:delta withEvent:event]; } - (void)rightClick:(UITouch *)touch withEvent:(UIEvent *)event { [[self nextResponder] rightClick:touch withEvent:event]; } - (void)mouseExitedView:(UIView *)exited enteredView:(UIView *)entered withEvent:(UIEvent *)event { [[self nextResponder] mouseExitedView:exited enteredView:entered withEvent:event]; } - (void)mouseMoved:(CGPoint)delta withEvent:(UIEvent *)event { [[self nextResponder] mouseMoved:delta withEvent:event]; } - (id)mouseCursorForEvent:(UIEvent *)event { return [[self nextResponder] mouseCursorForEvent:event]; } - (void)keyPressed:(UIKey *)key withEvent:(UIEvent *)event { UIResponder *responder = [self nextResponder]; if (responder) { [responder keyPressed:key withEvent:event]; } else { [event _setUnhandledKeyPressEvent]; } } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIRotationGestureRecognizer.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIGestureRecognizer.h" @interface UIRotationGestureRecognizer : UIGestureRecognizer { CGFloat _rotation; } @property (nonatomic) CGFloat rotation; @property (nonatomic,readonly) CGFloat velocity; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIRotationGestureRecognizer.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIRotationGestureRecognizer.h" #import "UIGestureRecognizerSubclass.h" @implementation UIRotationGestureRecognizer @synthesize rotation=_rotation; - (id)initWithTarget:(id)target action:(SEL)action { if ((self=[super initWithTarget:target action:action])) { _rotation = 0; } return self; } - (CGFloat)velocity { return 0; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIRoundedRectButton.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIButton.h" @interface UIRoundedRectButton : UIButton @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIRoundedRectButton.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIRoundedRectButton.h" #import "UIImage+UIPrivate.h" #import "UIColor.h" @implementation UIRoundedRectButton - (id)initWithFrame:(CGRect)frame { if ((self=[super initWithFrame:frame])) { _buttonType = UIButtonTypeRoundedRect; } return self; } - (UIColor *)_defaultTitleColor { return [UIColor blackColor]; } // Implemented using drawRect: since it seems the real rounded rect button is done that way, too since it still allows // you to define background images on the button itself which then render on top of the rounded rect. So.... whatever :) - (void)drawRect:(CGRect)rect { [(self.highlighted? [UIImage _highlightedRoundedRectButtonImage] : [UIImage _roundedRectButtonImage]) drawInRect:self.bounds]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIScreen+UIPrivate.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIScreen.h" @class UIView, UIEvent; @interface UIScreen (UIPrivate) - (void)_setUIKitView:(UIKitView *)theView; - (CALayer *)_layer; - (BOOL)_hasResizeIndicator; - (void)_setPopoverController:(UIPopoverController *)controller; - (UIPopoverController *)_popoverController; - (UIView *)_hitTest:(CGPoint)clickPoint event:(UIEvent *)theEvent; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIScreen.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import #import extern NSString *const UIScreenDidConnectNotification; extern NSString *const UIScreenDidDisconnectNotification; extern NSString *const UIScreenModeDidChangeNotification; @class UIImageView, CALayer, UIKitView, UIScreenMode, UIPopoverController; @interface UIScreen : NSObject { @private UIImageView *_grabber; CALayer *_layer; __unsafe_unretained UIKitView *_UIKitView; UIScreenMode *_currentMode; __unsafe_unretained UIPopoverController *_popoverController; } + (UIScreen *)mainScreen; + (NSArray *)screens; @property (nonatomic, readonly) CGRect bounds; @property (nonatomic, readonly) CGRect applicationFrame; @property (nonatomic, readonly, copy) NSArray *availableModes; // only ever returns the currentMode @property (nonatomic, strong) UIScreenMode *currentMode; // ignores any attempt to set this @property (nonatomic, readonly) CGFloat scale; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIScreen.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIScreen.h" #import "UIScreenAppKitIntegration.h" #import "UIImage+UIPrivate.h" #import "UIImageView.h" #import "UIApplication.h" #import #import #import "UIViewLayoutManager.h" #import "UIColor.h" #import "UIScreenMode+UIPrivate.h" #import "UIWindow.h" #import "UIKitView.h" #import "UIView+UIPrivate.h" NSString *const UIScreenDidConnectNotification = @"UIScreenDidConnectNotification"; NSString *const UIScreenDidDisconnectNotification = @"UIScreenDidDisconnectNotification"; NSString *const UIScreenModeDidChangeNotification = @"UIScreenModeDidChangeNotification"; NSMutableArray *_allScreens = nil; @implementation UIScreen @synthesize currentMode=_currentMode; + (void)initialize { if (self == [UIScreen class]) { _allScreens = [[NSMutableArray alloc] init]; } } + (UIScreen *)mainScreen { return ([_allScreens count] > 0)? [[_allScreens objectAtIndex:0] nonretainedObjectValue] : nil; } + (NSArray *)screens { NSMutableArray *screens = [NSMutableArray arrayWithCapacity:[_allScreens count]]; for (NSValue *v in _allScreens) { [screens addObject:[v nonretainedObjectValue]]; } return screens; } - (id)init { if ((self = [super init])) { _layer = [[CALayer layer] retain]; _layer.delegate = self; // required to get the magic of the UIViewLayoutManager... _layer.layoutManager = [UIViewLayoutManager layoutManager]; _grabber = [[UIImageView alloc] initWithImage:[UIImage _windowResizeGrabberImage]]; _grabber.layer.zPosition = 10000; [_layer addSublayer:_grabber.layer]; } return self; } - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; [_allScreens removeObject:[NSValue valueWithNonretainedObject:self]]; _layer.layoutManager = nil; _layer.delegate = nil; [_grabber.layer removeFromSuperlayer]; [_layer removeFromSuperlayer]; [_grabber release]; [_layer release]; [_currentMode release]; [super dealloc]; } - (CGFloat)scale { if ([[_UIKitView window] respondsToSelector:@selector(backingScaleFactor)]) { return [[_UIKitView window] backingScaleFactor]; } else { return 1; } } - (void)_setPopoverController:(UIPopoverController *)controller { _popoverController = controller; } - (UIPopoverController *)_popoverController { return _popoverController; } - (BOOL)_hasResizeIndicator { NSWindow *realWindow = [_UIKitView window]; NSView *contentView = [realWindow contentView]; if (_UIKitView && realWindow && contentView && ([realWindow styleMask] & NSResizableWindowMask) && [realWindow showsResizeIndicator] && !NSEqualSizes([realWindow minSize], [realWindow maxSize])) { const CGRect myBounds = NSRectToCGRect([_UIKitView bounds]); const CGPoint myLowerRight = CGPointMake(CGRectGetMaxX(myBounds),CGRectGetMaxY(myBounds)); const CGRect contentViewBounds = NSRectToCGRect([contentView frame]); const CGPoint contentViewLowerRight = CGPointMake(CGRectGetMaxX(contentViewBounds),0); const CGPoint convertedPoint = NSPointToCGPoint([_UIKitView convertPoint:NSPointFromCGPoint(myLowerRight) toView:contentView]); if (CGPointEqualToPoint(convertedPoint,contentViewLowerRight) && [realWindow showsResizeIndicator]) { return YES; } } return NO; } - (void)_layoutSubviews { if ([self _hasResizeIndicator]) { const CGSize grabberSize = _grabber.frame.size; const CGSize layerSize = _layer.bounds.size; CGRect grabberRect = _grabber.frame; grabberRect.origin = CGPointMake(layerSize.width-grabberSize.width,layerSize.height-grabberSize.height); _grabber.frame = grabberRect; _grabber.hidden = NO; } else if (!_grabber.hidden) { _grabber.hidden = YES; } } - (id)actionForLayer:(CALayer *)layer forKey:(NSString *)event { return [NSNull null]; } - (CGRect)applicationFrame { const float statusBarHeight = [UIApplication sharedApplication].statusBarHidden? 0 : 20; const CGSize size = [self bounds].size; return CGRectMake(0,statusBarHeight,size.width,size.height-statusBarHeight); } - (CGRect)bounds { return _layer.bounds; } - (CALayer *)_layer { return _layer; } - (void)_UIKitViewFrameDidChange { NSDictionary *userInfo = (self.currentMode)? [NSDictionary dictionaryWithObject:self.currentMode forKey:@"_previousMode"] : nil; self.currentMode = [UIScreenMode screenModeWithNSView:_UIKitView]; [[NSNotificationCenter defaultCenter] postNotificationName:UIScreenModeDidChangeNotification object:self userInfo:userInfo]; } - (void)_NSScreenDidChange { for (UIWindow *window in [[UIApplication sharedApplication].windows reverseObjectEnumerator]) { if (window.screen == self) { [window _didMoveToScreen]; } } } - (void)_setUIKitView:(id)theView { if (_UIKitView != theView) { [[NSNotificationCenter defaultCenter] removeObserver:self name:NSViewFrameDidChangeNotification object:_UIKitView]; [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidChangeScreenNotification object:nil]; if ((_UIKitView = theView)) { [_allScreens addObject:[NSValue valueWithNonretainedObject:self]]; self.currentMode = [UIScreenMode screenModeWithNSView:_UIKitView]; [[NSNotificationCenter defaultCenter] postNotificationName:UIScreenDidConnectNotification object:self]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_UIKitViewFrameDidChange) name:NSViewFrameDidChangeNotification object:_UIKitView]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_NSScreenDidChange) name:NSWindowDidChangeScreenNotification object:[_UIKitView window]]; [self _NSScreenDidChange]; } else { self.currentMode = nil; [_allScreens removeObject:[NSValue valueWithNonretainedObject:self]]; [[NSNotificationCenter defaultCenter] postNotificationName:UIScreenDidDisconnectNotification object:self]; } } } - (NSArray *)availableModes { return (self.currentMode)? [NSArray arrayWithObject:self.currentMode] : nil; } - (UIView *)_hitTest:(CGPoint)clickPoint event:(UIEvent *)theEvent { for (UIWindow *window in [[UIApplication sharedApplication].windows reverseObjectEnumerator]) { if (window.screen == self) { CGPoint windowPoint = [window convertPoint:clickPoint fromWindow:nil]; UIView *clickedView = [window hitTest:windowPoint withEvent:theEvent]; if (clickedView) { return clickedView; } } } return nil; } - (NSString *)description { return [NSString stringWithFormat:@"<%@: %p; bounds = %@; mode = %@>", [self className], self, NSStringFromCGRect(self.bounds), self.currentMode]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIScreenAppKitIntegration.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIScreen.h" @interface UIScreen (AppKitIntegration) // the real NSView that the screen lives on (or nil if there isn't one) - (UIKitView *)UIKitView; // promotes this screen to the main screen // this only changes what [UIScreen mainScreen] returns in the future, it doesn't move anything between views, etc. - (void)becomeMainScreen; // Using a nil screen will convert to OSX screen coordinates. - (CGPoint)convertPoint:(CGPoint)toConvert toScreen:(UIScreen *)toScreen; - (CGPoint)convertPoint:(CGPoint)toConvert fromScreen:(UIScreen *)fromScreen; - (CGRect)convertRect:(CGRect)toConvert toScreen:(UIScreen *)toScreen; - (CGRect)convertRect:(CGRect)toConvert fromScreen:(UIScreen *)fromScreen; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIScreenAppKitIntegration.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIScreenAppKitIntegration.h" #import "UIScreen+UIPrivate.h" #import "UIKitView.h" #import extern NSMutableArray *_allScreens; @implementation UIScreen (AppKitIntegration) - (UIKitView *)UIKitView { return _UIKitView; } - (CGPoint)convertPoint:(CGPoint)toConvert toScreen:(UIScreen *)toScreen { if (toScreen == self) { return toConvert; } else { // Go all the way through OSX screen coordinates. NSPoint screenCoords = [[_UIKitView window] convertBaseToScreen:[_UIKitView convertPoint:NSPointFromCGPoint(toConvert) toView:nil]]; if (toScreen) { // Now from there back to the toScreen's window's base return NSPointToCGPoint([[toScreen UIKitView] convertPoint:[[[toScreen UIKitView] window] convertScreenToBase:screenCoords] fromView:nil]); } else { return NSPointToCGPoint(screenCoords); } } } - (CGPoint)convertPoint:(CGPoint)toConvert fromScreen:(UIScreen *)fromScreen { if (fromScreen == self) { return toConvert; } else { NSPoint screenCoords; if (fromScreen) { // Go all the way through OSX screen coordinates. screenCoords = [[[fromScreen UIKitView] window] convertBaseToScreen:[[fromScreen UIKitView] convertPoint:NSPointFromCGPoint(toConvert) toView:nil]]; } else { screenCoords = NSPointFromCGPoint(toConvert); } // Now from there back to the our screen return NSPointToCGPoint([_UIKitView convertPoint:[[_UIKitView window] convertScreenToBase:screenCoords] fromView:nil]); } } - (CGRect)convertRect:(CGRect)toConvert toScreen:(UIScreen *)toScreen { CGPoint origin = [self convertPoint:CGPointMake(CGRectGetMinX(toConvert),CGRectGetMinY(toConvert)) toScreen:toScreen]; CGPoint bottom = [self convertPoint:CGPointMake(CGRectGetMaxX(toConvert),CGRectGetMaxY(toConvert)) toScreen:toScreen]; return CGRectStandardize(CGRectMake(origin.x, origin.y, bottom.x-origin.x, bottom.y-origin.y)); } - (CGRect)convertRect:(CGRect)toConvert fromScreen:(UIScreen *)fromScreen { CGPoint origin = [self convertPoint:CGPointMake(CGRectGetMinX(toConvert),CGRectGetMinY(toConvert)) fromScreen:fromScreen]; CGPoint bottom = [self convertPoint:CGPointMake(CGRectGetMaxX(toConvert),CGRectGetMaxY(toConvert)) fromScreen:fromScreen]; return CGRectStandardize(CGRectMake(origin.x, origin.y, bottom.x-origin.x, bottom.y-origin.y)); } - (void)becomeMainScreen { NSValue *entry = [NSValue valueWithNonretainedObject:self]; NSInteger index = [_allScreens indexOfObject:entry]; [_allScreens removeObjectAtIndex:index]; [_allScreens insertObject:entry atIndex:0]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIScreenMode+UIPrivate.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIScreenMode.h" @class NSView; @interface UIScreenMode () + (id)screenModeWithNSView:(NSView *)theNSView; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIScreenMode.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @interface UIScreenMode : NSObject { CGFloat _pixelAspectRatio; CGSize _size; } @property (readonly,nonatomic) CGFloat pixelAspectRatio; @property (readonly,nonatomic) CGSize size; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIScreenMode.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIScreenMode.h" #import "UIGeometry.h" #import @implementation UIScreenMode @synthesize pixelAspectRatio=_pixelAspectRatio, size=_size; + (id)screenModeWithNSView:(NSView *)theNSView { if (theNSView) { UIScreenMode *mode = [[self alloc] init]; mode->_size = NSSizeToCGSize([theNSView bounds].size); mode->_pixelAspectRatio = 1; return [mode autorelease]; } else { return nil; } } - (NSString *)description { return [NSString stringWithFormat:@"<%@: %p; size = %@>", [self className], self, NSStringFromCGSize(self.size)]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIScrollView+UIPrivate.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIScrollView.h" @interface UIScrollView (UIPrivate) - (void)_quickFlashScrollIndicators; - (CGPoint)_confinedContentOffset:(CGPoint)p; - (void)_setRestrainedContentOffset:(CGPoint)offset; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIScrollView.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIView.h" typedef enum { UIScrollViewIndicatorStyleDefault, UIScrollViewIndicatorStyleBlack, UIScrollViewIndicatorStyleWhite } UIScrollViewIndicatorStyle; extern const float UIScrollViewDecelerationRateNormal; extern const float UIScrollViewDecelerationRateFast; @class UIScroller, UIImageView, UIScrollView, UIPanGestureRecognizer, UIScrollWheelGestureRecognizer; @protocol UIScrollViewDelegate @optional - (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView; - (void)scrollViewDidScroll:(UIScrollView *)scrollView; - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView; - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate; - (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView; - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView; - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView; - (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(UIView *)view; - (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale; - (void)scrollViewDidZoom:(UIScrollView *)scrollView; @end @interface UIScrollView : UIView { @package __unsafe_unretained id _delegate; @private CGPoint _contentOffset; CGSize _contentSize; UIEdgeInsets _contentInset; UIEdgeInsets _scrollIndicatorInsets; UIScroller *_verticalScroller; UIScroller *_horizontalScroller; BOOL _showsVerticalScrollIndicator; BOOL _showsHorizontalScrollIndicator; float _maximumZoomScale; float _minimumZoomScale; BOOL _scrollsToTop; UIScrollViewIndicatorStyle _indicatorStyle; BOOL _delaysContentTouches; BOOL _canCancelContentTouches; BOOL _pagingEnabled; float _decelerationRate; BOOL _bouncesZoom; BOOL _bounces; BOOL _zooming; BOOL _dragging; BOOL _decelerating; UIPanGestureRecognizer *_panGestureRecognizer; UIScrollWheelGestureRecognizer *_scrollWheelGestureRecognizer; id _scrollAnimation; NSTimer *_scrollTimer; struct { unsigned scrollViewDidScroll : 1; unsigned scrollViewWillBeginDragging : 1; unsigned scrollViewDidEndDragging : 1; unsigned viewForZoomingInScrollView : 1; unsigned scrollViewWillBeginZooming : 1; unsigned scrollViewDidEndZooming : 1; unsigned scrollViewDidZoom : 1; unsigned scrollViewDidEndScrollingAnimation : 1; unsigned scrollViewWillBeginDecelerating : 1; unsigned scrollViewDidEndDecelerating : 1; } _delegateCan; // should be flag struct BOOL _alwaysBounceHorizontal; BOOL _alwaysBounceVertical; } - (void)scrollRectToVisible:(CGRect)rect animated:(BOOL)animated; - (void)setZoomScale:(float)scale animated:(BOOL)animated; - (void)zoomToRect:(CGRect)rect animated:(BOOL)animated; - (void)setContentOffset:(CGPoint)theOffset animated:(BOOL)animated; - (void)flashScrollIndicators; // does nothing @property (nonatomic) CGSize contentSize; @property (nonatomic) CGPoint contentOffset; @property (nonatomic) UIEdgeInsets contentInset; @property (nonatomic) UIEdgeInsets scrollIndicatorInsets; @property (nonatomic) UIScrollViewIndicatorStyle indicatorStyle; @property (nonatomic) BOOL showsHorizontalScrollIndicator; @property (nonatomic) BOOL showsVerticalScrollIndicator; @property (nonatomic) BOOL bounces; @property (nonatomic) BOOL alwaysBounceVertical; @property (nonatomic) BOOL alwaysBounceHorizontal; @property (nonatomic, getter=isScrollEnabled) BOOL scrollEnabled; @property (nonatomic, assign) id delegate; @property (nonatomic) BOOL scrollsToTop; // no effect @property (nonatomic) BOOL delaysContentTouches; // no effect @property (nonatomic) BOOL canCancelContentTouches; // no effect @property (nonatomic, readonly, getter=isDragging) BOOL dragging; @property (nonatomic, readonly, getter=isTracking) BOOL tracking; // always returns NO @property (nonatomic, readonly, getter=isDecelerating) BOOL decelerating; // always returns NO @property (nonatomic, assign) BOOL pagingEnabled; @property (nonatomic) float decelerationRate; @property (nonatomic) float maximumZoomScale; @property (nonatomic) float minimumZoomScale; @property (nonatomic) float zoomScale; @property (nonatomic, readonly, getter=isZooming) BOOL zooming; @property (nonatomic, readonly, getter=isZoomBouncing) BOOL zoomBouncing; // always NO @property (nonatomic) BOOL bouncesZoom; // no effect @property (nonatomic, readonly) UIPanGestureRecognizer *panGestureRecognizer; @property (nonatomic, readonly) UIScrollWheelGestureRecognizer *scrollWheelGestureRecognizer; // non-standard @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIScrollView.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIScrollView.h" #import "UIView+UIPrivate.h" #import "UIScroller.h" #import "UIScreen+UIPrivate.h" #import "UIWindow.h" #import "UITouch.h" #import "UIImageView.h" #import "UIImage+UIPrivate.h" #import "UIResponderAppKitIntegration.h" #import "UIScrollViewAnimationScroll.h" #import "UIScrollViewAnimationDeceleration.h" #import "UIPanGestureRecognizer.h" #import "UIScrollWheelGestureRecognizer.h" #import static const NSTimeInterval UIScrollViewAnimationDuration = 0.33; static const NSTimeInterval UIScrollViewQuickAnimationDuration = 0.22; static const NSUInteger UIScrollViewScrollAnimationFramesPerSecond = 60; const float UIScrollViewDecelerationRateNormal = 0.998; const float UIScrollViewDecelerationRateFast = 0.99; @interface UIScrollView () <_UIScrollerDelegate> @end @implementation UIScrollView @synthesize contentOffset=_contentOffset, contentInset=_contentInset, scrollIndicatorInsets=_scrollIndicatorInsets; @synthesize showsHorizontalScrollIndicator=_showsHorizontalScrollIndicator, showsVerticalScrollIndicator=_showsVerticalScrollIndicator, contentSize=_contentSize; @synthesize maximumZoomScale=_maximumZoomScale, minimumZoomScale=_minimumZoomScale, scrollsToTop=_scrollsToTop; @synthesize indicatorStyle=_indicatorStyle, delaysContentTouches=_delaysContentTouches, delegate=_delegate, pagingEnabled=_pagingEnabled; @synthesize canCancelContentTouches=_canCancelContentTouches, bouncesZoom=_bouncesZoom, zooming=_zooming; @synthesize alwaysBounceVertical=_alwaysBounceVertical, alwaysBounceHorizontal=_alwaysBounceHorizontal, bounces=_bounces; @synthesize decelerationRate=_decelerationRate, scrollWheelGestureRecognizer=_scrollWheelGestureRecognizer, panGestureRecognizer=_panGestureRecognizer; - (id)initWithFrame:(CGRect)frame { if ((self=[super initWithFrame:frame])) { _contentOffset = CGPointZero; _contentSize = CGSizeZero; _contentInset = UIEdgeInsetsZero; _scrollIndicatorInsets = UIEdgeInsetsZero; _showsVerticalScrollIndicator = YES; _showsHorizontalScrollIndicator = YES; _maximumZoomScale = 1; _minimumZoomScale = 1; _scrollsToTop = YES; _indicatorStyle = UIScrollViewIndicatorStyleDefault; _delaysContentTouches = YES; _canCancelContentTouches = YES; _pagingEnabled = NO; _bouncesZoom = NO; _zooming = NO; _alwaysBounceVertical = NO; _alwaysBounceHorizontal = NO; _bounces = YES; _decelerationRate = UIScrollViewDecelerationRateNormal; _panGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(_gestureDidChange:)]; [self addGestureRecognizer:_panGestureRecognizer]; _scrollWheelGestureRecognizer = [[UIScrollWheelGestureRecognizer alloc] initWithTarget:self action:@selector(_gestureDidChange:)]; [self addGestureRecognizer:_scrollWheelGestureRecognizer]; _verticalScroller = [[UIScroller alloc] init]; _verticalScroller.delegate = self; [self addSubview:_verticalScroller]; _horizontalScroller = [[UIScroller alloc] init]; _horizontalScroller.delegate = self; [self addSubview:_horizontalScroller]; self.clipsToBounds = YES; } return self; } - (void)dealloc { _horizontalScroller.delegate = nil; _verticalScroller.delegate = nil; [_panGestureRecognizer release]; [_scrollWheelGestureRecognizer release]; [_scrollAnimation release]; [_verticalScroller release]; [_horizontalScroller release]; [super dealloc]; } - (void)setDelegate:(id)newDelegate { _delegate = newDelegate; _delegateCan.scrollViewDidScroll = [_delegate respondsToSelector:@selector(scrollViewDidScroll:)]; _delegateCan.scrollViewWillBeginDragging = [_delegate respondsToSelector:@selector(scrollViewWillBeginDragging:)]; _delegateCan.scrollViewDidEndDragging = [_delegate respondsToSelector:@selector(scrollViewDidEndDragging:willDecelerate:)]; _delegateCan.viewForZoomingInScrollView = [_delegate respondsToSelector:@selector(viewForZoomingInScrollView:)]; _delegateCan.scrollViewWillBeginZooming = [_delegate respondsToSelector:@selector(scrollViewWillBeginZooming:withView:)]; _delegateCan.scrollViewDidEndZooming = [_delegate respondsToSelector:@selector(scrollViewDidEndZooming:withView:atScale:)]; _delegateCan.scrollViewDidZoom = [_delegate respondsToSelector:@selector(scrollViewDidZoom:)]; _delegateCan.scrollViewDidEndScrollingAnimation = [_delegate respondsToSelector:@selector(scrollViewDidEndScrollingAnimation:)]; _delegateCan.scrollViewWillBeginDecelerating = [_delegate respondsToSelector:@selector(scrollViewWillBeginDecelerating:)]; _delegateCan.scrollViewDidEndDecelerating = [_delegate respondsToSelector:@selector(scrollViewDidEndDecelerating:)]; } - (UIView *)_zoomingView { return (_delegateCan.viewForZoomingInScrollView)? [_delegate viewForZoomingInScrollView:self] : nil; } - (void)setIndicatorStyle:(UIScrollViewIndicatorStyle)style { _indicatorStyle = style; _horizontalScroller.indicatorStyle = style; _verticalScroller.indicatorStyle = style; } - (void)setShowsHorizontalScrollIndicator:(BOOL)show { _showsHorizontalScrollIndicator = show; [self setNeedsLayout]; } - (void)setShowsVerticalScrollIndicator:(BOOL)show { _showsVerticalScrollIndicator = show; [self setNeedsLayout]; } - (BOOL)_canScrollHorizontal { return self.scrollEnabled && (_contentSize.width > self.bounds.size.width); } - (BOOL)_canScrollVertical { return self.scrollEnabled && (_contentSize.height > self.bounds.size.height); } - (void)_updateScrollers { _verticalScroller.contentSize = _contentSize.height; _verticalScroller.contentOffset = _contentOffset.y; _horizontalScroller.contentSize = _contentSize.width; _horizontalScroller.contentOffset = _contentOffset.x; _verticalScroller.hidden = !self._canScrollVertical; _horizontalScroller.hidden = !self._canScrollHorizontal; } - (void)setScrollEnabled:(BOOL)enabled { self.panGestureRecognizer.enabled = enabled; self.scrollWheelGestureRecognizer.enabled = enabled; [self _updateScrollers]; [self setNeedsLayout]; } - (BOOL)isScrollEnabled { return self.panGestureRecognizer.enabled || self.scrollWheelGestureRecognizer.enabled; } - (void)_cancelScrollAnimation { [_scrollTimer invalidate]; _scrollTimer = nil; [_scrollAnimation release]; _scrollAnimation = nil; if (_delegateCan.scrollViewDidEndScrollingAnimation) { [_delegate scrollViewDidEndScrollingAnimation:self]; } if (_decelerating) { _horizontalScroller.alwaysVisible = NO; _verticalScroller.alwaysVisible = NO; _decelerating = NO; if (_delegateCan.scrollViewDidEndDecelerating) { [_delegate scrollViewDidEndDecelerating:self]; } } } - (void)_updateScrollAnimation { if ([_scrollAnimation animate]) { [self _cancelScrollAnimation]; } } - (void)_setScrollAnimation:(UIScrollViewAnimation *)animation { [self _cancelScrollAnimation]; _scrollAnimation = [animation retain]; if (!_scrollTimer) { _scrollTimer = [NSTimer scheduledTimerWithTimeInterval:1/(NSTimeInterval)UIScrollViewScrollAnimationFramesPerSecond target:self selector:@selector(_updateScrollAnimation) userInfo:nil repeats:YES]; } } - (CGPoint)_confinedContentOffset:(CGPoint)contentOffset { const CGRect scrollerBounds = UIEdgeInsetsInsetRect(self.bounds, _contentInset); if ((_contentSize.width-contentOffset.x) < scrollerBounds.size.width) { contentOffset.x = (_contentSize.width - scrollerBounds.size.width); } if ((_contentSize.height-contentOffset.y) < scrollerBounds.size.height) { contentOffset.y = (_contentSize.height - scrollerBounds.size.height); } contentOffset.x = MAX(contentOffset.x,0); contentOffset.y = MAX(contentOffset.y,0); if (_contentSize.width <= scrollerBounds.size.width) { contentOffset.x = 0; } if (_contentSize.height <= scrollerBounds.size.height) { contentOffset.y = 0; } return contentOffset; } - (void)_setRestrainedContentOffset:(CGPoint)offset { const CGPoint confinedOffset = [self _confinedContentOffset:offset]; const CGRect scrollerBounds = UIEdgeInsetsInsetRect(self.bounds, _contentInset); if (!self.alwaysBounceHorizontal && _contentSize.width <= scrollerBounds.size.width) { offset.x = confinedOffset.x; } if (!self.alwaysBounceVertical && _contentSize.height <= scrollerBounds.size.height) { offset.y = confinedOffset.y; } self.contentOffset = offset; } - (void)_confineContent { self.contentOffset = [self _confinedContentOffset:_contentOffset]; } - (void)layoutSubviews { [super layoutSubviews]; const CGRect bounds = self.bounds; const CGFloat scrollerSize = UIScrollerWidthForBoundsSize(bounds.size); _verticalScroller.frame = CGRectMake(bounds.origin.x+bounds.size.width-scrollerSize-_scrollIndicatorInsets.right,bounds.origin.y+_scrollIndicatorInsets.top,scrollerSize,bounds.size.height-_scrollIndicatorInsets.top-_scrollIndicatorInsets.bottom); _horizontalScroller.frame = CGRectMake(bounds.origin.x+_scrollIndicatorInsets.left,bounds.origin.y+bounds.size.height-scrollerSize-_scrollIndicatorInsets.bottom,bounds.size.width-_scrollIndicatorInsets.left-_scrollIndicatorInsets.right,scrollerSize); } - (void)setFrame:(CGRect)frame { [super setFrame:frame]; [self _confineContent]; } - (void)_bringScrollersToFront { [super bringSubviewToFront:_horizontalScroller]; [super bringSubviewToFront:_verticalScroller]; } - (void)addSubview:(UIView *)subview { [super addSubview:subview]; [self _bringScrollersToFront]; } - (void)bringSubviewToFront:(UIView *)subview { [super bringSubviewToFront:subview]; [self _bringScrollersToFront]; } - (void)insertSubview:(UIView *)subview atIndex:(NSInteger)index { [super insertSubview:subview atIndex:index]; [self _bringScrollersToFront]; } - (void)setContentOffset:(CGPoint)theOffset animated:(BOOL)animated { if (animated) { UIScrollViewAnimationScroll *animation = [[UIScrollViewAnimationScroll alloc] initWithScrollView:self fromContentOffset:self.contentOffset toContentOffset:theOffset duration:UIScrollViewAnimationDuration curve:UIScrollViewAnimationScrollCurveLinear]; [self _setScrollAnimation:animation]; [animation release]; } else { _contentOffset.x = roundf(theOffset.x); _contentOffset.y = roundf(theOffset.y); CGRect bounds = self.bounds; bounds.origin.x = _contentOffset.x+_contentInset.left; bounds.origin.y = _contentOffset.y+_contentInset.top; self.bounds = bounds; [self _updateScrollers]; [self setNeedsLayout]; if (_delegateCan.scrollViewDidScroll) { [_delegate scrollViewDidScroll:self]; } } } - (void)setContentOffset:(CGPoint)theOffset { [self setContentOffset:theOffset animated:NO]; } - (void)setContentSize:(CGSize)newSize { if (!CGSizeEqualToSize(newSize, _contentSize)) { _contentSize = newSize; [self _confineContent]; } } - (void)flashScrollIndicators { [_horizontalScroller flash]; [_verticalScroller flash]; } - (void)_quickFlashScrollIndicators { [_horizontalScroller quickFlash]; [_verticalScroller quickFlash]; } - (BOOL)isTracking { return NO; } - (void)mouseMoved:(CGPoint)delta withEvent:(UIEvent *)event { UITouch *touch = [[event allTouches] anyObject]; const CGPoint point = [touch locationInView:self]; const CGFloat scrollerSize = UIScrollerWidthForBoundsSize(self.bounds.size); const BOOL shouldShowHorizontal = CGRectContainsPoint(CGRectInset(_horizontalScroller.frame, -scrollerSize, -scrollerSize), point); const BOOL shouldShowVertical = CGRectContainsPoint(CGRectInset(_verticalScroller.frame, -scrollerSize, -scrollerSize), point); const BOOL shouldShowScrollers = (shouldShowVertical || shouldShowHorizontal || _decelerating); _horizontalScroller.alwaysVisible = shouldShowScrollers; _verticalScroller.alwaysVisible = shouldShowScrollers; [super mouseMoved:delta withEvent:event]; } - (void)mouseExitedView:(UIView *)exited enteredView:(UIView *)entered withEvent:(UIEvent *)event { if (!_decelerating) { if ([exited isDescendantOfView:self] && ![entered isDescendantOfView:self]) { _horizontalScroller.alwaysVisible = NO; _verticalScroller.alwaysVisible = NO; } } [super mouseExitedView:exited enteredView:entered withEvent:event]; } - (UIScrollViewAnimation *)_pageSnapAnimation { const CGSize pageSize = self.bounds.size; const CGSize numberOfWholePages = CGSizeMake(floorf(_contentSize.width/pageSize.width), floorf(_contentSize.height/pageSize.height)); const CGSize currentRawPage = CGSizeMake(_contentOffset.x/pageSize.width, _contentOffset.y/pageSize.height); const CGSize currentPage = CGSizeMake(floorf(currentRawPage.width), floorf(currentRawPage.height)); const CGSize currentPagePercentage = CGSizeMake(1-(currentRawPage.width-currentPage.width), 1-(currentRawPage.height-currentPage.height)); CGPoint finalContentOffset = CGPointZero; // if currentPagePercentage is less than 50%, then go to the next page (if any), otherwise snap to the current page if (currentPagePercentage.width < 0.5 && (currentPage.width+1) < numberOfWholePages.width) { finalContentOffset.x = pageSize.width * (currentPage.width + 1); } else { finalContentOffset.x = pageSize.width * currentPage.width; } if (currentPagePercentage.height < 0.5 && (currentPage.height+1) < numberOfWholePages.height) { finalContentOffset.y = pageSize.height * (currentPage.height + 1); } else { finalContentOffset.y = pageSize.height * currentPage.height; } // quickly animate the snap (if necessary) if (!CGPointEqualToPoint(finalContentOffset, _contentOffset)) { return [[[UIScrollViewAnimationScroll alloc] initWithScrollView:self fromContentOffset:_contentOffset toContentOffset:finalContentOffset duration:UIScrollViewQuickAnimationDuration curve:UIScrollViewAnimationScrollCurveQuadraticEaseOut] autorelease]; } else { return nil; } } - (UIScrollViewAnimation *)_decelerationAnimationWithVelocity:(CGPoint)velocity { const CGPoint confinedOffset = [self _confinedContentOffset:_contentOffset]; // if we've pulled up the content outside it's bounds, we don't want to register any flick momentum there and instead just // have the animation pull the content back into place immediately. if (confinedOffset.x != _contentOffset.x) { velocity.x = 0; } if (confinedOffset.y != _contentOffset.y) { velocity.y = 0; } if (!CGPointEqualToPoint(velocity, CGPointZero) || !CGPointEqualToPoint(confinedOffset, _contentOffset)) { return [[[UIScrollViewAnimationDeceleration alloc] initWithScrollView:self velocity:velocity] autorelease]; } else { return nil; } } - (void)_beginDragging { if (!_dragging) { _dragging = YES; _horizontalScroller.alwaysVisible = YES; _verticalScroller.alwaysVisible = YES; [self _cancelScrollAnimation]; if (_delegateCan.scrollViewWillBeginDragging) { [_delegate scrollViewWillBeginDragging:self]; } } } - (BOOL)isDragging { return _dragging; } - (void)_endDraggingWithDecelerationVelocity:(CGPoint)velocity { if (_dragging) { _dragging = NO; UIScrollViewAnimation *decelerationAnimation = _pagingEnabled? [self _pageSnapAnimation] : [self _decelerationAnimationWithVelocity:velocity]; if (_delegateCan.scrollViewDidEndDragging) { [_delegate scrollViewDidEndDragging:self willDecelerate:(decelerationAnimation != nil)]; } if (decelerationAnimation) { [self _setScrollAnimation:decelerationAnimation]; _horizontalScroller.alwaysVisible = YES; _verticalScroller.alwaysVisible = YES; _decelerating = YES; if (_delegateCan.scrollViewWillBeginDecelerating) { [_delegate scrollViewWillBeginDecelerating:self]; } } else { _horizontalScroller.alwaysVisible = NO; _verticalScroller.alwaysVisible = NO; [self _confineContent]; } } } - (void)_dragBy:(CGPoint)delta { if (_dragging) { _horizontalScroller.alwaysVisible = YES; _verticalScroller.alwaysVisible = YES; const CGPoint originalOffset = self.contentOffset; CGPoint proposedOffset = originalOffset; proposedOffset.x += delta.x; proposedOffset.y += delta.y; const CGPoint confinedOffset = [self _confinedContentOffset:proposedOffset]; if (self.bounces) { BOOL shouldHorizontalBounce = (fabs(proposedOffset.x - confinedOffset.x) > 0); BOOL shouldVerticalBounce = (fabs(proposedOffset.y - confinedOffset.y) > 0); if (shouldHorizontalBounce) { proposedOffset.x = originalOffset.x + (0.055 * delta.x); } if (shouldVerticalBounce) { proposedOffset.y = originalOffset.y + (0.055 * delta.y); } [self _setRestrainedContentOffset:proposedOffset]; } else { [self setContentOffset:confinedOffset]; } } } - (void)_gestureDidChange:(UIGestureRecognizer *)gesture { // the scrolling gestures are broken into two components due to the somewhat fundamental differences // in how they are handled by the system. The UIPanGestureRecognizer will only track scrolling gestures // that come from actual touch scroller devices. This does *not* include old fashioned mouse wheels. // the non-standard UIScrollWheelGestureRecognizer is a discrete recognizer which only responds to // non-gesture scroll events such as those from non-touch devices. HOWEVER the system sends momentum // scroll events *after* the touch gesture has ended which allows for us to distinguish the difference // here between actual touch gestures and the momentum gestures and thus feed them into the playing // deceleration animation as we receive them so that we can preserve the system's proper feel for that. // Also important to note is that with a legacy scroll device, each movement of the wheel is going to // trigger a beginDrag, dragged, endDragged sequence. I believe that's an acceptable compromise however // it might cause some potentially strange behavior in client code that is not expecting such rapid // state changes along these lines. // Another note is that only touch-based panning gestures will trigger calls to _dragBy: which means // that only touch devices can possibly pull the content outside of the scroll view's bounds while // active. An old fashioned wheel will not be able to do that and its scroll events are confined to // the bounds of the scroll view. // There are some semi-legacy devices like the magic mouse which 10.6 doesn't seem to consider a true // touch device, so it doesn't send the gestureBegin/ended stuff that's used to recognize such things // but it *will* send momentum events. This means that those devices on 10.6 won't give you the feeling // of being able to grab and pull your content away from the bounds like a proper touch trackpad will. // As of 10.7 it appears Apple fixed this and they do actually send the proper gesture events, so on // 10.7 the magic mouse should end up acting like any other touch input device as far as we're concerned. // Momentum scrolling doesn't work terribly well with how the paging stuff is now handled. Something // could be improved there. I'm not sure if the paging animation should just pretend it's longer to // kind of "mask" the OS' momentum events, or if a flag should be set, or if it should work so that // even in paging mode the deceleration and stuff happens like usual and it only snaps to the correct // page *after* the usual deceleration is done. I can't decide what might be best, but since we // don't use paging mode in Twitterrific at the moment, I'm not suffeciently motivated to worry about it. :) if (gesture == _panGestureRecognizer) { if (_panGestureRecognizer.state == UIGestureRecognizerStateBegan) { [self _beginDragging]; } else if (_panGestureRecognizer.state == UIGestureRecognizerStateChanged) { [self _dragBy:[_panGestureRecognizer translationInView:self]]; [_panGestureRecognizer setTranslation:CGPointZero inView:self]; } else if (_panGestureRecognizer.state == UIGestureRecognizerStateEnded) { [self _endDraggingWithDecelerationVelocity:[_panGestureRecognizer velocityInView:self]]; } } else if (gesture == _scrollWheelGestureRecognizer) { if (_scrollWheelGestureRecognizer.state == UIGestureRecognizerStateRecognized) { const CGPoint delta = [_scrollWheelGestureRecognizer translationInView:self]; if (_decelerating) { // note that we might be "decelerating" but actually just snapping to a page boundary in paging mode, // so we need to verify if we can actually send this message to the current animation or not. // if we can't, then we'll just eat the scroll event and let the animation finish instead. // additional note: the reason this is done this way at all is so that the system's momentum // messages can be preserved perfectly rather than trying to emulate them myself. this results // in a better feeling end product even if the bouncing at the edges isn't quite entirely right. // see notes in UIScrollViewAnimationDeceleration.m for more. if ([_scrollAnimation respondsToSelector:@selector(momentumScrollBy:)]) { [_scrollAnimation momentumScrollBy:delta]; } } else { CGPoint offset = self.contentOffset; offset.x += delta.x; offset.y += delta.y; offset = [self _confinedContentOffset:offset]; if (!CGPointEqualToPoint(offset, _contentOffset)) { [self _beginDragging]; self.contentOffset = offset; [self _endDraggingWithDecelerationVelocity:CGPointZero]; } [self _quickFlashScrollIndicators]; } } } } - (void)_UIScrollerDidBeginDragging:(UIScroller *)scroller withEvent:(UIEvent *)event { [self _beginDragging]; } - (void)_UIScroller:(UIScroller *)scroller contentOffsetDidChange:(CGFloat)newOffset { if (scroller == _verticalScroller) { [self setContentOffset:CGPointMake(self.contentOffset.x,newOffset) animated:NO]; } else if (scroller == _horizontalScroller) { [self setContentOffset:CGPointMake(newOffset,self.contentOffset.y) animated:NO]; } } - (void)_UIScrollerDidEndDragging:(UIScroller *)scroller withEvent:(UIEvent *)event { UITouch *touch = [[event allTouches] anyObject]; const CGPoint point = [touch locationInView:self]; if (!CGRectContainsPoint(scroller.frame,point)) { scroller.alwaysVisible = NO; } [self _endDraggingWithDecelerationVelocity:CGPointZero]; } - (BOOL)isDecelerating { return NO; } - (void)scrollRectToVisible:(CGRect)rect animated:(BOOL)animated { const CGRect contentRect = CGRectMake(0,0,_contentSize.width, _contentSize.height); const CGRect visibleRect = self.bounds; CGRect goalRect = CGRectIntersection(rect, contentRect); if (!CGRectIsNull(goalRect) && !CGRectContainsRect(visibleRect, goalRect)) { // clamp the goal rect to the largest possible size for it given the visible space available // this causes it to prefer the top-left of the rect if the rect is too big goalRect.size.width = MIN(goalRect.size.width, visibleRect.size.width); goalRect.size.height = MIN(goalRect.size.height, visibleRect.size.height); CGPoint offset = self.contentOffset; if (CGRectGetMaxY(goalRect) > CGRectGetMaxY(visibleRect)) { offset.y += CGRectGetMaxY(goalRect) - CGRectGetMaxY(visibleRect); } else if (CGRectGetMinY(goalRect) < CGRectGetMinY(visibleRect)) { offset.y += CGRectGetMinY(goalRect) - CGRectGetMinY(visibleRect); } if (CGRectGetMaxX(goalRect) > CGRectGetMaxX(visibleRect)) { offset.x += CGRectGetMaxX(goalRect) - CGRectGetMaxX(visibleRect); } else if (CGRectGetMinX(goalRect) < CGRectGetMinX(visibleRect)) { offset.x += CGRectGetMinX(goalRect) - CGRectGetMinX(visibleRect); } [self setContentOffset:offset animated:animated]; } } - (BOOL)isZoomBouncing { return NO; } - (float)zoomScale { UIView *zoomingView = [self _zoomingView]; // it seems weird to return the "a" component of the transform for this, but after some messing around with the real UIKit, I'm // reasonably certain that's how it is doing it. return zoomingView? zoomingView.transform.a : 1.f; } - (void)setZoomScale:(float)scale animated:(BOOL)animated { UIView *zoomingView = [self _zoomingView]; scale = MIN(MAX(scale, _minimumZoomScale), _maximumZoomScale); if (zoomingView && self.zoomScale != scale) { [UIView animateWithDuration:animated? UIScrollViewAnimationDuration : 0 delay:0 options:UIViewAnimationOptionCurveEaseOut | UIViewAnimationOptionBeginFromCurrentState animations:^(void) { zoomingView.transform = CGAffineTransformMakeScale(scale, scale); const CGSize size = zoomingView.frame.size; zoomingView.layer.position = CGPointMake(size.width/2.f, size.height/2.f); self.contentSize = size; } completion:NULL]; } } - (void)setZoomScale:(float)scale { [self setZoomScale:scale animated:NO]; } - (void)zoomToRect:(CGRect)rect animated:(BOOL)animated { } - (NSString *)description { return [NSString stringWithFormat:@"<%@: %p; frame = (%.0f %.0f; %.0f %.0f); clipsToBounds = %@; layer = %@; contentOffset = {%.0f, %.0f}>", [self className], self, self.frame.origin.x, self.frame.origin.y, self.frame.size.width, self.frame.size.height, (self.clipsToBounds ? @"YES" : @"NO"), self.layer, self.contentOffset.x, self.contentOffset.y]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIScrollViewAnimation.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIScrollView+UIPrivate.h" @interface UIScrollViewAnimation : NSObject { @package UIScrollView *scrollView; NSTimeInterval beginTime; } - (id)initWithScrollView:(UIScrollView *)sv; - (BOOL)animate; @end extern CGFloat UILinearInterpolation(CGFloat t, CGFloat start, CGFloat end); extern CGFloat UIQuadraticEaseOut(CGFloat t, CGFloat start, CGFloat end); ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIScrollViewAnimation.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIScrollViewAnimation.h" CGFloat UILinearInterpolation(CGFloat t, CGFloat start, CGFloat end) { if (t <= 0) { return start; } else if (t >= 1) { return end; } else { return t * end + (1 - t) * start; } } CGFloat UIQuadraticEaseOut(CGFloat t, CGFloat start, CGFloat end) { if (t <= 0) { return start; } else if (t >= 1) { return end; } else { return UILinearInterpolation(2 * t - t * t, start, end); } } @implementation UIScrollViewAnimation - (id)initWithScrollView:(UIScrollView *)sv { if ((self=[super init])) { scrollView = sv; beginTime = [NSDate timeIntervalSinceReferenceDate]; } return self; } - (BOOL)animate { return YES; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIScrollViewAnimationDeceleration.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIScrollViewAnimation.h" typedef struct { NSTimeInterval decelerateTime; CGFloat position; CGFloat velocity; NSTimeInterval returnTime; CGFloat returnFrom; BOOL bounced; } UIScrollViewAnimationDecelerationComponent; @interface UIScrollViewAnimationDeceleration : UIScrollViewAnimation { UIScrollViewAnimationDecelerationComponent x; UIScrollViewAnimationDecelerationComponent y; NSTimeInterval lastMomentumTime; } - (id)initWithScrollView:(UIScrollView *)sv velocity:(CGPoint)v; - (void)momentumScrollBy:(CGPoint)delta; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIScrollViewAnimationDeceleration.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIScrollViewAnimationDeceleration.h" /* I attempted to emulate 10.7's behavior here as best I could, however my physics-fu is weak. It doesn't feel quite right so it's possible this approach is vastly wrong, but it's decent for now, I suppose. I've noticed that while OSX appears to have a springy feel when you bounce into an edge, it will only spring out to the maximum and then snaps back to the resting position. In other words it appears that no matter how hard you throw the content at the edge, it will always spring out to some maximum (which appears to be based on how hard you've thrown it) and then quickly snaps back to the home position for that axis - it does not contniue bouncing like a proper spring might. So what I've tried to do here is emulate a kind of springy behavior right up until applying the spring's tension results in a sufficiently slow velocity. At that point I switch to a static animation which returns the content to its final resting place within a fixed time. Additionally, rather than attempt to emulate the correct momentum scrolling animation and perfectly match the friction and deceleration curves, I found a way to pass the OS' momentum scroll events into this animation as they occur by way of -momentumScrollBy:. What happens here is if the animation has started to bounce the content, it will then ignore changes coming from that method for the rest of its run. The idea is that once an edge has hit the wall, the animation will be in my hands from that point on so as to avoid feeding additional accelerations into the process and causing the bouncing to get out of hand. I had originally attempted to animate the momentum scrolling myself as well but I could never seem to match the feel of the system's momentum in terms of friction/deceleration-rate, etc. Again it is possible this isn't actually as hard as it seems to me, but my sadly terrible math abilities are failing me here. I guess I just don't know how to correctly frame this problem in my mind to acheive the results I wish I could achieve at the moment. Hopefully someone else who's better at this can come along and make it better somehow. There's another important reason that emulating my own momentum animation ran into trouble. On OSX if you flick to scroll and momentum is happening, the moment you place your fingers on the trackpad the momentum will stop. Without utterly changing how events are read in from OSX, I had no easy way note when the user simply placed their fingers on the trackpad and therefore had no easy way to cancel a momentum scrolling animation at that moment. The normal scrolling gesture isn't recognized until the user moves their fingers a bit. This resulted in a pretty terrible feeling where you could flick a bit and start a momentum scroll and then place your fingers on the trackpad to stop the scroll would not work. It was highly jarring. By passing the system's momentum events through instead, it solves the problem because the system intelligently will stop sending momentum scrolls the moment the user touches their fingers down again on the trackpad and thus we automatically stop receiving them. A timer on the animation keeps an eye out for future scroll events and if they don't appear within a short time, the animation is considered finished (assuming all bouncing is completed) and thus will end the deceleration sequence entirely and UIScrollView ends up sending the proper delegate messages, etc. New scrolls such as a new pan gesture will cancel the animation directly so things will proceed as expected in those situations. */ static const CGFloat minimumBounceVelocityBeforeReturning = 100; static const NSTimeInterval returnAnimationDuration = 0.33; static const NSTimeInterval physicsTimeStep = 1/120.; static const CGFloat springTightness = 7; static const CGFloat springDampening = 15; static CGFloat Clamp(CGFloat v, CGFloat min, CGFloat max) { return (v < min)? min : (v > max)? max : v; } static CGFloat ClampedVelocty(CGFloat v) { const CGFloat V = 200; return Clamp(v, -V, V); } static CGFloat Spring(CGFloat velocity, CGFloat position, CGFloat restPosition, CGFloat tightness, CGFloat dampening) { const CGFloat d = position - restPosition; return (-tightness * d) - (dampening * velocity); } static BOOL BounceComponent(NSTimeInterval t, UIScrollViewAnimationDecelerationComponent *c, CGFloat to) { if (c->bounced && c->returnTime != 0) { const NSTimeInterval returnBounceTime = MIN(1, ((t - c->returnTime) / returnAnimationDuration)); c->position = UIQuadraticEaseOut(returnBounceTime, c->returnFrom, to); return (returnBounceTime == 1); } else if (fabs(to - c->position) > 0) { const CGFloat F = Spring(c->velocity, c->position, to, springTightness, springDampening); c->velocity += F * physicsTimeStep; c->position += c->velocity * physicsTimeStep; c->bounced = YES; if (fabs(c->velocity) < minimumBounceVelocityBeforeReturning) { c->returnFrom = c->position; c->returnTime = t; } return NO; } else { return YES; } } @implementation UIScrollViewAnimationDeceleration - (id)initWithScrollView:(UIScrollView *)sv velocity:(CGPoint)v; { if ((self=[super initWithScrollView:sv])) { lastMomentumTime = beginTime; x.decelerateTime = beginTime; x.velocity = ClampedVelocty(v.x); x.position = scrollView.contentOffset.x; x.returnFrom = 0; x.returnTime = 0; x.bounced = NO; y.decelerateTime = beginTime; y.velocity = ClampedVelocty(v.y); y.position = scrollView.contentOffset.y; y.returnFrom = 0; y.returnTime = 0; y.bounced = NO; // if the velocity is 0, we're going to assume we just need to return it back to position immediately // this works around the case where the content was already at an edge and the user just flicked in // such a way that it should bounce a bit and return to the proper offset. not doing something like this // (along with the associated code in UIScrollView) results in crazy forces being applied in those cases. if (x.velocity == 0) { x.bounced = YES; x.returnTime = beginTime; x.returnFrom = x.position; } if (y.velocity == 0) { y.bounced = YES; y.returnTime = beginTime; y.returnFrom = y.position; } } return self; } - (BOOL)animate { const NSTimeInterval currentTime = [NSDate timeIntervalSinceReferenceDate]; const BOOL isFinishedWaitingForMomentumScroll = ((currentTime - lastMomentumTime) > 0.15f); BOOL finished = NO; while (!finished && currentTime >= beginTime) { CGPoint confinedOffset = [scrollView _confinedContentOffset:CGPointMake(x.position, y.position)]; const BOOL verticalIsFinished = BounceComponent(beginTime, &y, confinedOffset.y); const BOOL horizontalIsFinished = BounceComponent(beginTime, &x, confinedOffset.x); finished = (verticalIsFinished && horizontalIsFinished && isFinishedWaitingForMomentumScroll); beginTime += physicsTimeStep; } [scrollView _setRestrainedContentOffset:CGPointMake(x.position, y.position)]; return finished; } - (void)momentumScrollBy:(CGPoint)delta { lastMomentumTime = [NSDate timeIntervalSinceReferenceDate]; if (!x.bounced) { x.position += delta.x; x.velocity = ClampedVelocty(delta.x / (lastMomentumTime - x.decelerateTime)); x.decelerateTime = lastMomentumTime; } if (!y.bounced) { y.position += delta.y; y.velocity = ClampedVelocty(delta.y / (lastMomentumTime - y.decelerateTime)); y.decelerateTime = lastMomentumTime; } } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIScrollViewAnimationScroll.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIScrollViewAnimation.h" typedef enum { UIScrollViewAnimationScrollCurveLinear, UIScrollViewAnimationScrollCurveQuadraticEaseOut } UIScrollViewAnimationScrollCurve; @interface UIScrollViewAnimationScroll : UIScrollViewAnimation { CGPoint beginContentOffset; CGPoint endContentOffset; NSTimeInterval duration; UIScrollViewAnimationScrollCurve curve; } - (id)initWithScrollView:(UIScrollView *)sv fromContentOffset:(CGPoint)from toContentOffset:(CGPoint)to duration:(NSTimeInterval)d curve:(UIScrollViewAnimationScrollCurve)c; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIScrollViewAnimationScroll.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIScrollViewAnimationScroll.h" @implementation UIScrollViewAnimationScroll - (id)initWithScrollView:(UIScrollView *)sv fromContentOffset:(CGPoint)from toContentOffset:(CGPoint)to duration:(NSTimeInterval)d curve:(UIScrollViewAnimationScrollCurve)c { if ((self=[super initWithScrollView:sv])) { beginContentOffset = from; endContentOffset = to; duration = d; curve = c; } return self; } - (BOOL)animate { const NSTimeInterval currentTime = [NSDate timeIntervalSinceReferenceDate]; const NSTimeInterval elapsedTime = currentTime - beginTime; const CGFloat animationPosition = MIN(1, (elapsedTime / duration)); CGFloat (*curveFunction)(CGFloat t, CGFloat start, CGFloat end) = (curve == UIScrollViewAnimationScrollCurveLinear)? &UILinearInterpolation : &UIQuadraticEaseOut; scrollView.contentOffset = CGPointMake(curveFunction(animationPosition, beginContentOffset.x, endContentOffset.x), curveFunction(animationPosition, beginContentOffset.y, endContentOffset.y)); return (animationPosition == 1); } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIScrollWheelGestureRecognizer.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIGestureRecognizer.h" // This will only trigger on old-school scroll wheels and momentum scroll events. // Unlike UIPanGestureRecognizer, this is a discrete recognizer. It is also, // obviously, entirely non-standard. :) @interface UIScrollWheelGestureRecognizer : UIGestureRecognizer { CGPoint _translation; } - (CGPoint)translationInView:(UIView *)view; - (void)setTranslation:(CGPoint)translation inView:(UIView *)view; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIScrollWheelGestureRecognizer.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIScrollWheelGestureRecognizer.h" #import "UIGestureRecognizerSubclass.h" #import "UITouch+UIPrivate.h" #import "UIEvent.h" @implementation UIScrollWheelGestureRecognizer - (CGPoint)translationInView:(UIView *)view { return _translation; } - (void)setTranslation:(CGPoint)translation inView:(UIView *)view { _translation = translation; } - (void)_discreteGestures:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [[event touchesForGestureRecognizer:self] anyObject]; if (self.state == UIGestureRecognizerStatePossible && [touch _gesture] == _UITouchDiscreteGestureScrollWheel) { [self setTranslation:[touch _delta] inView:touch.view]; self.state = UIGestureRecognizerStateRecognized; } } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIScroller.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIView.h" #import "UIScrollView.h" @class UIImageView, UIScroller; CGFloat UIScrollerWidthForBoundsSize(CGSize boundsSize); @protocol _UIScrollerDelegate - (void)_UIScrollerDidBeginDragging:(UIScroller *)scroller withEvent:(UIEvent *)event; - (void)_UIScroller:(UIScroller *)scroller contentOffsetDidChange:(CGFloat)newOffset; - (void)_UIScrollerDidEndDragging:(UIScroller *)scroller withEvent:(UIEvent *)event; @end @interface UIScroller : UIView { @private __unsafe_unretained id<_UIScrollerDelegate> _delegate; CGFloat _contentOffset; CGFloat _contentSize; CGFloat _dragOffset; BOOL _draggingKnob; BOOL _isVertical; CGPoint _lastTouchLocation; NSTimer *_holdTimer; UIScrollViewIndicatorStyle _indicatorStyle; NSTimer *_fadeTimer; BOOL _alwaysVisible; } // NOTE: UIScroller set's its own alpha to 0 when it is created, so it is NOT visible by default! // the flash/quickFlash methods alter its own alpha in order to fade in/out, etc. - (void)flash; - (void)quickFlash; @property (nonatomic, assign) BOOL alwaysVisible; // if YES, -flash has no effect on the scroller's alpha, setting YES fades alpha to 1, setting NO fades it out if it was visible @property (nonatomic, assign) id<_UIScrollerDelegate> delegate; @property (nonatomic, assign) CGFloat contentSize; // used to calulate how big the slider knob should be (uses its own frame height/width and compares against this value) @property (nonatomic, assign) CGFloat contentOffset; // set this after contentSize is set or else it'll normalize in unexpected ways @property (nonatomic) UIScrollViewIndicatorStyle indicatorStyle; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIScroller.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIScroller.h" #import "UITouch.h" #import "UIBezierPath.h" #import "UIColor.h" static const BOOL _UIScrollerGutterEnabled = NO; static const BOOL _UIScrollerJumpToSpotThatIsClicked = NO; // _UIScrollerGutterEnabled must be YES for this to have any meaning static const CGFloat _UIScrollerMinimumAlpha = 0; CGFloat UIScrollerWidthForBoundsSize(CGSize boundsSize) { const CGFloat minViewSize = 50; if (boundsSize.width <= minViewSize || boundsSize.height <= minViewSize) { return 6; } else { return 10; } } @implementation UIScroller @synthesize delegate=_delegate, contentOffset=_contentOffset, contentSize=_contentSize; @synthesize indicatorStyle=_indicatorStyle, alwaysVisible=_alwaysVisible; - (id)initWithFrame:(CGRect)frame { if ((self=[super initWithFrame:frame])) { self.opaque = NO; self.alpha = _UIScrollerMinimumAlpha; self.indicatorStyle = UIScrollViewIndicatorStyleDefault; } return self; } - (void)setFrame:(CGRect)frame { _isVertical = (frame.size.height > frame.size.width); [super setFrame:frame]; } - (void)_fadeOut { [_fadeTimer invalidate]; _fadeTimer = nil; [UIView animateWithDuration:0.33 delay:0 options:UIViewAnimationOptionCurveEaseOut | UIViewAnimationOptionTransitionNone | UIViewAnimationOptionAllowUserInteraction animations:^(void) { self.alpha = _UIScrollerMinimumAlpha; } completion:NULL]; } - (void)_fadeOutAfterDelay:(NSTimeInterval)time { [_fadeTimer invalidate]; _fadeTimer = [NSTimer scheduledTimerWithTimeInterval:time target:self selector:@selector(_fadeOut) userInfo:nil repeats:NO]; } - (void)_fadeIn { [_fadeTimer invalidate]; _fadeTimer = nil; [UIView animateWithDuration:0.33 delay:0 options:UIViewAnimationOptionCurveEaseOut | UIViewAnimationOptionTransitionNone | UIViewAnimationOptionAllowUserInteraction animations:^(void) { self.alpha = 1; } completion:NULL]; } - (void)flash { [self _fadeIn]; if (!_alwaysVisible) { [self _fadeOutAfterDelay:1.5]; } } - (void)quickFlash { self.alpha = 1; if (!_alwaysVisible) { [self _fadeOutAfterDelay:0.5]; } } - (void)setAlwaysVisible:(BOOL)v { _alwaysVisible = v; if (_alwaysVisible) { [self _fadeIn]; } else if (self.alpha > _UIScrollerMinimumAlpha && !_fadeTimer) { [self _fadeOut]; } } - (void)setIndicatorStyle:(UIScrollViewIndicatorStyle)style { _indicatorStyle = style; [self setNeedsDisplay]; } - (CGFloat)knobSize { const CGRect bounds = self.bounds; const CGFloat dimension = MAX(bounds.size.width, bounds.size.height); const CGFloat knobScale = MIN(1, (dimension / _contentSize)); return MAX((dimension * knobScale), 50); } - (CGRect)knobRect { const CGRect bounds = self.bounds; const CGFloat dimension = MAX(bounds.size.width, bounds.size.height); const CGFloat maxContentSize = MAX(1,(_contentSize-dimension)); const CGFloat knobSize = [self knobSize]; const CGFloat positionScale = MIN(1, (MIN(_contentOffset,maxContentSize) / maxContentSize)); const CGFloat knobPosition = (dimension - knobSize) * positionScale; if (_isVertical) { return CGRectMake(bounds.origin.x, knobPosition, bounds.size.width, knobSize); } else { return CGRectMake(knobPosition, bounds.origin.y, knobSize, bounds.size.height); } } - (void)setContentOffset:(CGFloat)newOffset { _contentOffset = MIN(MAX(0,newOffset),_contentSize); [self setNeedsDisplay]; } - (void)setContentSize:(CGFloat)newContentSize { _contentSize = newContentSize; [self setNeedsDisplay]; } - (void)setContentOffsetWithLastTouch { const CGRect bounds = self.bounds; const CGFloat dimension = _isVertical? bounds.size.height : bounds.size.width; const CGFloat maxContentOffset = _contentSize - dimension; const CGFloat knobSize = [self knobSize]; const CGFloat point = _isVertical? _lastTouchLocation.y : _lastTouchLocation.x; const CGFloat knobPosition = MIN(MAX(0, point-_dragOffset), (dimension-knobSize)); const CGFloat contentOffset = (knobPosition / (dimension-knobSize)) * maxContentOffset; [self setContentOffset:contentOffset]; } - (void)pageUp { if (_isVertical) { [self setContentOffset:_contentOffset-self.bounds.size.height]; } else { [self setContentOffset:_contentOffset-self.bounds.size.width]; } } - (void)pageDown { if (_isVertical) { [self setContentOffset:_contentOffset+self.bounds.size.height]; } else { [self setContentOffset:_contentOffset+self.bounds.size.width]; } } - (void)autoPageContent { const CGRect knobRect = [self knobRect]; if (!CGRectContainsPoint(knobRect, _lastTouchLocation) && CGRectContainsPoint(self.bounds, _lastTouchLocation)) { BOOL shouldPageUp; if (_isVertical) { shouldPageUp = (_lastTouchLocation.y < knobRect.origin.y); } else { shouldPageUp = (_lastTouchLocation.x < knobRect.origin.x); } if (shouldPageUp) { [self pageUp]; } else { [self pageDown]; } [_delegate _UIScroller:self contentOffsetDidChange:_contentOffset]; } } - (void)startHoldPaging { [_holdTimer invalidate]; _holdTimer = [NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(autoPageContent) userInfo:nil repeats:YES]; } - (void)drawRect:(CGRect)rect { CGRect knobRect = [self knobRect]; if (_isVertical) { knobRect.origin.y += 2; knobRect.size.height -= 4; knobRect.origin.x += 1; knobRect.size.width -= 3; } else { knobRect.origin.y += 1; knobRect.size.height -= 3; knobRect.origin.x += 2; knobRect.size.width -= 4; } UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:knobRect cornerRadius:4]; if (_indicatorStyle == UIScrollViewIndicatorStyleBlack) { [[[UIColor blackColor] colorWithAlphaComponent:0.5] setFill]; } else if (_indicatorStyle == UIScrollViewIndicatorStyleWhite) { [[[UIColor whiteColor] colorWithAlphaComponent:0.5] setFill]; } else { [[[UIColor blackColor] colorWithAlphaComponent:0.5] setFill]; [[[UIColor whiteColor] colorWithAlphaComponent:0.3] setStroke]; [path setLineWidth:1.8]; [path stroke]; } [path fill]; } - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { _lastTouchLocation = [[touches anyObject] locationInView:self]; const CGRect knobRect = [self knobRect]; if (CGRectContainsPoint(knobRect,_lastTouchLocation)) { if (_isVertical) { _dragOffset = _lastTouchLocation.y - knobRect.origin.y; } else { _dragOffset = _lastTouchLocation.x - knobRect.origin.x; } _draggingKnob = YES; [_delegate _UIScrollerDidBeginDragging:self withEvent:event]; } else if (_UIScrollerGutterEnabled) { [_delegate _UIScrollerDidBeginDragging:self withEvent:event]; if (_UIScrollerJumpToSpotThatIsClicked) { _dragOffset = [self knobSize] / 2.f; _draggingKnob = YES; [self setContentOffsetWithLastTouch]; [_delegate _UIScroller:self contentOffsetDidChange:_contentOffset]; } else { [self autoPageContent]; _holdTimer = [NSTimer scheduledTimerWithTimeInterval:0.33 target:self selector:@selector(startHoldPaging) userInfo:nil repeats:NO]; } } } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { _lastTouchLocation = [[touches anyObject] locationInView:self]; if (_draggingKnob) { [self setContentOffsetWithLastTouch]; [_delegate _UIScroller:self contentOffsetDidChange:_contentOffset]; } } - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { if (_draggingKnob) { _draggingKnob = NO; [_delegate _UIScrollerDidEndDragging:self withEvent:event]; } else if (_holdTimer) { [_delegate _UIScrollerDidEndDragging:self withEvent:event]; [_holdTimer invalidate]; _holdTimer = nil; } } - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { UIView *hit = [super hitTest:point withEvent:event]; // if the gutter is disabled, then we pretend the view is invisible to events if the user clicks in the gutter // otherwise the scroller would capture those clicks and things wouldn't work as expected. if (hit == self && !_UIScrollerGutterEnabled && !CGRectContainsPoint([self knobRect],point)) { hit = nil; } return hit; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UISearchBar.h ================================================ // // UISearchBar.h // UIKit // // Created by Peter Steinberger on 23.03.11. // /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIView.h" #import "UITextField.h" @protocol UISearchBarDelegate; @interface UISearchBar : UIView { UITextField *_searchField; BOOL _showsCancelButton; __unsafe_unretained id _delegate; NSString *_placeholder; } @property (nonatomic, copy) NSString *text; @property (nonatomic,assign) id delegate; @property (nonatomic) BOOL showsCancelButton; @property (nonatomic,copy) NSString *placeholder; @end @protocol UISearchBarDelegate @optional - (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar; - (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar; - (BOOL)searchBarShouldEndEditing:(UISearchBar *)searchBar; - (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar; - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText; - (BOOL)searchBar:(UISearchBar *)searchBar shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text; - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar; - (void)searchBarBookmarkButtonClicked:(UISearchBar *)searchBar; - (void)searchBarCancelButtonClicked:(UISearchBar *) searchBar; - (void)searchBarResultsListButtonClicked:(UISearchBar *)searchBar; - (void)searchBar:(UISearchBar *)searchBar selectedScopeButtonIndexDidChange:(NSInteger)selectedScope; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UISearchBar.m ================================================ // // UISearchBar.m // UIKit // // Created by Peter Steinberger on 23.03.11. // /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UISearchBar.h" @implementation UISearchBar @synthesize delegate=_delegate, showsCancelButton = _showsCancelButton, placeholder=_placeholder; - (id)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { _searchField = [[UITextField alloc] initWithFrame:frame]; [self addSubview:_searchField]; } return self; } - (void)dealloc { _delegate = nil; [_placeholder release]; [_searchField release]; [super dealloc]; } - (NSString *)text { return _searchField.text; } - (void)setText:(NSString *)text { _searchField.text = text; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UISearchDisplayController.h ================================================ // // UISearchDisplayController.h // UIKit // // Created by Peter Steinberger on 23.03.11. // /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UITableView.h" @class UISearchBar, UITableView, UIViewController, UIPopoverController; @protocol UITableViewDataSource, UITableViewDelegate, UISearchDisplayDelegate; @interface UISearchDisplayController : NSObject { UIViewController *_viewController; UISearchBar *_searchBar; UITableView *_tableView; __unsafe_unretained id _delegate; __unsafe_unretained id _tableViewDataSource; __unsafe_unretained id _tableViewDelegate; } - (id)initWithSearchBar:(UISearchBar *)searchBar contentsController:(UIViewController *)viewController; @property (nonatomic, assign) id delegate; @property (nonatomic, getter=isActive) BOOL active; - (void)setActive:(BOOL)visible animated:(BOOL)animated; @property (nonatomic, readonly) UISearchBar *searchBar; @property (nonatomic, readonly) UIViewController *searchContentsController; @property (nonatomic,readonly) UITableView *searchResultsTableView; @property (nonatomic,assign) id searchResultsDataSource; @property (nonatomic,assign) id searchResultsDelegate; @end @protocol UISearchDisplayDelegate @optional // when we start/end showing the search UI - (void)searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller; - (void)searchDisplayControllerDidBeginSearch:(UISearchDisplayController *)controller; - (void)searchDisplayControllerWillEndSearch:(UISearchDisplayController *)controller; - (void)searchDisplayControllerDidEndSearch:(UISearchDisplayController *)controller; // called when the table is created destroyed, shown or hidden. configure as necessary. - (void)searchDisplayController:(UISearchDisplayController *)controller didLoadSearchResultsTableView:(UITableView *)tableView; - (void)searchDisplayController:(UISearchDisplayController *)controller willUnloadSearchResultsTableView:(UITableView *)tableView; // called when table is shown/hidden - (void)searchDisplayController:(UISearchDisplayController *)controller willShowSearchResultsTableView:(UITableView *)tableView; - (void)searchDisplayController:(UISearchDisplayController *)controller didShowSearchResultsTableView:(UITableView *)tableView; - (void)searchDisplayController:(UISearchDisplayController *)controller willHideSearchResultsTableView:(UITableView *)tableView; - (void)searchDisplayController:(UISearchDisplayController *)controller didHideSearchResultsTableView:(UITableView *)tableView; // return YES to reload table. called when search string/option changes. convenience methods on top UISearchBar delegate methods - (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString; - (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchScope:(NSInteger)searchOption; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UISearchDisplayController.m ================================================ // // UISearchDisplayController.m // UIKit // // Created by Peter Steinberger on 23.03.11. // /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UISearchDisplayController.h" #import "UISearchBar.h" #import "UIViewController.h" @implementation UISearchDisplayController @synthesize searchContentsController = _viewController; @synthesize searchBar = _searchBar; @synthesize searchResultsTableView = _tableView; @synthesize searchResultsDataSource = _tableViewDataSource; @synthesize searchResultsDelegate = _tableViewDelegate; @synthesize delegate = _delegate; - (id)initWithSearchBar:(UISearchBar *)searchBar contentsController:(UIViewController *)viewController { if ((self = [super init])) { _searchBar = [searchBar retain]; _viewController = [viewController retain]; } return self; } - (void)dealloc { _delegate = nil; _tableViewDataSource = nil; _tableViewDelegate = nil; [_searchBar release]; [_viewController release]; [super dealloc]; } - (BOOL)isActive { return NO; } - (void)setActive:(BOOL)active { [self setActive:active animated:NO]; } - (void)setActive:(BOOL)visible animated:(BOOL)animated { } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UISegmentedControl.h ================================================ // // SSSegmentedControl.h // SSToolkit // // Created by Sam Soffes on 2/7/11. // Copyright 2011 Sam Soffes. All rights reserved. // // Limitiations: // - Removing and inserting items is not supported // - Setting item width is not supported // - Setting item content offset is not supported #import "UIControl.h" #import "UIImage.h" #import "UIFont.h" typedef enum { UISegmentedControlStylePlain, // large plain UISegmentedControlStyleBordered, // large bordered UISegmentedControlStyleBar, // small button/nav bar style. tintable UISegmentedControlStyleBezeled, // large bezeled style. tintable } UISegmentedControlStyle; enum { UISegmentedControlNoSegment = -1 // segment index for no selected segment }; @interface UISegmentedControl : UIControl { @private NSMutableArray *_segments; NSInteger _selectedSegmentIndex; NSUInteger _numberOfSegments; BOOL _momentary; NSMutableDictionary *_segmentMeta; UIImage *_buttonImage; UIImage *_highlightedButtonImage; UIImage *_dividerImage; UIImage *_highlightedDividerImage; UIFont *_font; UIColor *_textColor; UIColor *_disabledTextColor; UIColor *_textShadowColor; CGSize _textShadowOffset; UIEdgeInsets _textEdgeInsets; UISegmentedControlStyle _segmentedControlStyle; UIColor *_tintColor; } @property (nonatomic) UISegmentedControlStyle segmentedControlStyle; // stub @property (nonatomic,strong) UIColor *tintColor; // stub @property (nonatomic, assign, readonly) NSUInteger numberOfSegments; @property (nonatomic, assign) NSInteger selectedSegmentIndex; @property (nonatomic, getter=isMomentary) BOOL momentary; - (id)initWithItems:(NSArray *)items; //- (void)insertSegmentWithTitle:(NSString *)title atIndex:(NSUInteger)segment animated:(BOOL)animated; //- (void)insertSegmentWithImage:(UIImage *)image atIndex:(NSUInteger)segment animated:(BOOL)animated; //- (void)removeSegmentAtIndex:(NSUInteger)segment animated:(BOOL)animated; //- (void)removeAllSegments; - (void)setTitle:(NSString *)title forSegmentAtIndex:(NSUInteger)segment; - (NSString *)titleForSegmentAtIndex:(NSUInteger)segment; - (void)setImage:(UIImage *)image forSegmentAtIndex:(NSUInteger)segment; - (UIImage *)imageForSegmentAtIndex:(NSUInteger)segment; //- (void)setWidth:(CGFloat)width forSegmentAtIndex:(NSUInteger)segment; //- (CGFloat)widthForSegmentAtIndex:(NSUInteger)segment; //- (void)setContentOffset:(CGSize)offset forSegmentAtIndex:(NSUInteger)segment; //- (CGSize)contentOffsetForSegmentAtIndex:(NSUInteger)segment; - (void)setEnabled:(BOOL)enabled forSegmentAtIndex:(NSUInteger)segment; - (BOOL)isEnabledForSegmentAtIndex:(NSUInteger)segment; - (void)setTitleTextAttributes:(NSDictionary *)attributes forState:(UIControlState)state; - (NSDictionary *)titleTextAttributesForState:(UIControlState)state; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UISegmentedControl.m ================================================ // // SSSegmentedControl.m // SSToolkit // // Created by Sam Soffes on 2/7/11. // Copyright 2011 Sam Soffes. All rights reserved. // #import "UISegmentedControl.h" #import "UITouch.h" #import "UIColor.h" #import "UIStringDrawing.h" #import "UIGraphics.h" static NSString *kSSSegmentedControlEnabledKey = @"enabled"; @interface UISegmentedControl () @property (nonatomic, strong) UIImage *buttonImage; @property (nonatomic, strong) UIImage *highlightedButtonImage; @property (nonatomic, strong) UIImage *dividerImage; @property (nonatomic, strong) UIImage *highlightedDividerImage; @property (nonatomic, strong) UIFont *font; @property (nonatomic, strong) UIColor *textColor; @property (nonatomic, strong) UIColor *disabledTextColor; @property (nonatomic, strong) UIColor *textShadowColor; @property (nonatomic, assign) CGSize textShadowOffset; @property (nonatomic, assign) UIEdgeInsets textEdgeInsets; - (NSMutableDictionary *)_metaForSegmentIndex:(NSUInteger)index; - (id)_metaValueForKey:(NSString *)key segmentIndex:(NSUInteger)index; - (void)_setMetaValue:(id)value forKey:(NSString *)key segmentIndex:(NSUInteger)index; @end @implementation UISegmentedControl @synthesize numberOfSegments = _numberOfSegments; @synthesize selectedSegmentIndex = _selectedSegmentIndex; @synthesize momentary = _momentary; @synthesize buttonImage = _buttonImage; @synthesize highlightedButtonImage = _highlightedButtonImage; @synthesize dividerImage = _dividerImage; @synthesize highlightedDividerImage = _highlightedDividerImage; @synthesize font = _font; @synthesize textColor = _textColor; @synthesize disabledTextColor = _disabledTextColor; @synthesize textShadowColor = _textShadowColor; @synthesize textShadowOffset = _textShadowOffset; @synthesize textEdgeInsets = _textEdgeInsets; @synthesize segmentedControlStyle = _segmentedControlStyle; @synthesize tintColor = _tintColor; #pragma mark NSObject - (void)dealloc { [_segments release]; [_buttonImage release]; [_highlightedButtonImage release]; [_dividerImage release]; [_highlightedDividerImage release]; [_font release]; [_textColor release]; [_disabledTextColor release]; [_textShadowColor release]; [_segmentMeta release]; [_tintColor release]; [super dealloc]; } #pragma mark UIResponder - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; CGFloat x = [touch locationInView:self].x; // Ignore touches that don't matter if (x < 0 || x > self.frame.size.width) { return; } NSUInteger index = (NSUInteger)floorf((CGFloat)x / (self.frame.size.width / (CGFloat)[self numberOfSegments])); if ([self isEnabledForSegmentAtIndex:index]) { self.selectedSegmentIndex = (NSInteger)index; } } - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { if (!_momentary) { return; } _selectedSegmentIndex = UISegmentedControlNoSegment; [self setNeedsDisplay]; } #pragma mark UIView - (id)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { self.backgroundColor = [UIColor clearColor]; _segments = [[NSMutableArray alloc] init]; _momentary = NO; // TODO: add images self.buttonImage = [[UIImage imageNamed:@"UISegmentBarButton.png"] stretchableImageWithLeftCapWidth:6 topCapHeight:0]; self.highlightedButtonImage = [[UIImage imageNamed:@"UISegmentBarButtonHighlighted.png"] stretchableImageWithLeftCapWidth:6 topCapHeight:0]; self.dividerImage = [UIImage imageNamed:@"UISegmentBarDivider.png"]; self.highlightedDividerImage = [UIImage imageNamed:@"UISegmentBarDividerHighlighted.png"]; self.selectedSegmentIndex = UISegmentedControlNoSegment; _font = [[UIFont boldSystemFontOfSize:12.0f] retain]; _textColor = [[UIColor whiteColor] retain]; _disabledTextColor = [[UIColor colorWithWhite:0.561f alpha:1.0f] retain]; _textShadowColor = [[UIColor colorWithWhite:0.0f alpha:0.5f] retain]; _textShadowOffset = CGSizeMake(0.0f, -1.0f); _textEdgeInsets = UIEdgeInsetsMake(-1.0f, 0.0f, 0.0f, 0.0f); } return self; } - (void)drawRect:(CGRect)frame { static CGFloat dividerWidth = 1.0f; NSInteger count = (NSInteger)[self numberOfSegments]; CGSize size = frame.size; CGFloat segmentWidth = roundf((size.width - count - 1) / (CGFloat)count); CGContextRef context = UIGraphicsGetCurrentContext(); for (NSInteger i = 0; i < count; i++) { CGContextSaveGState(context); id item = [_segments objectAtIndex:(NSUInteger)i]; BOOL enabled = [self isEnabledForSegmentAtIndex:(NSUInteger)i]; CGFloat x = (segmentWidth * (CGFloat)i + (((CGFloat)i + 1) * dividerWidth)); // Draw dividers if (i > 0) { NSInteger p = i - 1; UIImage *dividerImage = nil; // Selected divider if ((p >= 0 && p == _selectedSegmentIndex) || i == _selectedSegmentIndex) { dividerImage = _highlightedDividerImage; } // Normal divider else { dividerImage = _dividerImage; } [dividerImage drawInRect:CGRectMake(x - 1.0f, 0.0f, dividerWidth, size.height)]; } CGRect segmentRect = CGRectMake(x, 0.0f, segmentWidth, size.height); CGContextClipToRect(context, segmentRect); // Background UIImage *backgroundImage = nil; CGRect backgroundRect = segmentRect; if (_selectedSegmentIndex == i) { backgroundImage = _highlightedButtonImage; } else { backgroundImage = _buttonImage; } CGFloat capWidth = backgroundImage.leftCapWidth; // First segment if (i == 0) { backgroundRect.size.width += capWidth; } // Last segment else if (i == count - 1) { backgroundRect = CGRectMake(backgroundRect.origin.x - capWidth, backgroundRect.origin.y, backgroundRect.size.width + capWidth, backgroundRect.size.height); } // Middle segment else { backgroundRect = CGRectMake(backgroundRect.origin.x - capWidth, backgroundRect.origin.y, backgroundRect.size.width + capWidth + capWidth, backgroundRect.size.height); } [backgroundImage drawInRect:backgroundRect]; // Strings if ([item isKindOfClass:[NSString class]]) { NSString *string = (NSString *)item; CGSize textSize = [string sizeWithFont:_font constrainedToSize:CGSizeMake(segmentWidth, size.height) lineBreakMode:UILineBreakModeTailTruncation]; CGRect textRect = CGRectMake(x, roundf((size.height - textSize.height) / 2.0f), segmentWidth, size.height); textRect = UIEdgeInsetsInsetRect(textRect, _textEdgeInsets); if (enabled) { [_textShadowColor set]; [string drawInRect:CGRectOffset(textRect, _textShadowOffset.width, _textShadowOffset.height) withFont:_font lineBreakMode:UILineBreakModeTailTruncation alignment:UITextAlignmentCenter]; [_textColor set]; } else { [_disabledTextColor set]; } [string drawInRect:textRect withFont:_font lineBreakMode:UILineBreakModeTailTruncation alignment:UITextAlignmentCenter]; } // Images else if ([item isKindOfClass:[UIImage class]]) { UIImage *image = (UIImage *)item; CGSize imageSize = image.size; CGRect imageRect = CGRectMake(x + roundf((segmentRect.size.width - imageSize.width) / 2.0f), roundf((segmentRect.size.height - imageSize.height) / 2.0f), imageSize.width, imageSize.height); [image drawInRect:imageRect blendMode:kCGBlendModeNormal alpha:enabled ? 1.0f : 0.5f]; } CGContextRestoreGState(context); } } - (void)willMoveToSuperview:(UIView *)newSuperview { [super willMoveToSuperview:newSuperview]; if (newSuperview) { [self addObserver:self forKeyPath:@"buttonImage" options:NSKeyValueObservingOptionNew context:nil]; [self addObserver:self forKeyPath:@"highlightedButtonImage" options:NSKeyValueObservingOptionNew context:nil]; [self addObserver:self forKeyPath:@"dividerImage" options:NSKeyValueObservingOptionNew context:nil]; [self addObserver:self forKeyPath:@"highlightedDividerImage" options:NSKeyValueObservingOptionNew context:nil]; [self addObserver:self forKeyPath:@"font" options:NSKeyValueObservingOptionNew context:nil]; [self addObserver:self forKeyPath:@"textColor" options:NSKeyValueObservingOptionNew context:nil]; [self addObserver:self forKeyPath:@"disabledTextColor" options:NSKeyValueObservingOptionNew context:nil]; [self addObserver:self forKeyPath:@"textShadowColor" options:NSKeyValueObservingOptionNew context:nil]; [self addObserver:self forKeyPath:@"textShadowOffset" options:NSKeyValueObservingOptionNew context:nil]; [self addObserver:self forKeyPath:@"textEdgeInsets" options:NSKeyValueObservingOptionNew context:nil]; } else { [self removeObserver:self forKeyPath:@"buttonImage"]; [self removeObserver:self forKeyPath:@"highlightedButtonImage"]; [self removeObserver:self forKeyPath:@"dividerImage"]; [self removeObserver:self forKeyPath:@"highlightedDividerImage"]; [self removeObserver:self forKeyPath:@"font"]; [self removeObserver:self forKeyPath:@"textColor"]; [self removeObserver:self forKeyPath:@"disabledTextColor"]; [self removeObserver:self forKeyPath:@"textShadowColor"]; [self removeObserver:self forKeyPath:@"textShadowOffset"]; [self removeObserver:self forKeyPath:@"textEdgeInsets"]; } } #pragma mark Initializer - (id)initWithItems:(NSArray *)items { if ((self = [self initWithFrame:CGRectZero])) { NSInteger index = 0; for (id item in items) { if ([item isKindOfClass:[NSString class]]) { [self setTitle:item forSegmentAtIndex:(NSUInteger)index]; index++; } else if ([item isKindOfClass:[UIImage class]]) { [self setImage:item forSegmentAtIndex:(NSUInteger)index]; index++; } } } return self; } #pragma mark Segments - (NSUInteger)numberOfSegments { return [_segments count]; } - (void)setTitle:(NSString *)title forSegmentAtIndex:(NSUInteger)segment { if ((NSInteger)([self numberOfSegments] - 1) < (NSInteger)segment) { [_segments addObject:title]; } else { [_segments replaceObjectAtIndex:segment withObject:title]; } [self setNeedsDisplay]; } - (NSString *)titleForSegmentAtIndex:(NSUInteger)segment { if ([self numberOfSegments] - 1 >= segment) { return nil; } id item = [_segments objectAtIndex:segment]; if ([item isKindOfClass:[NSString class]]) { return item; } return nil; } - (void)setImage:(UIImage *)image forSegmentAtIndex:(NSUInteger)segment { if ((NSInteger)([self numberOfSegments] - 1) < (NSInteger)segment) { [_segments addObject:image]; } else { [_segments replaceObjectAtIndex:segment withObject:image]; } [self setNeedsDisplay]; } - (UIImage *)imageForSegmentAtIndex:(NSUInteger)segment { if ([self numberOfSegments] - 1 >= segment) { return nil; } id item = [_segments objectAtIndex:segment]; if ([item isKindOfClass:[UIImage class]]) { return item; } return nil; } - (void)setEnabled:(BOOL)enabled forSegmentAtIndex:(NSUInteger)segment { [self _setMetaValue:[NSNumber numberWithBool:enabled] forKey:kSSSegmentedControlEnabledKey segmentIndex:segment]; } - (BOOL)isEnabledForSegmentAtIndex:(NSUInteger)segment { NSNumber *value = [self _metaValueForKey:kSSSegmentedControlEnabledKey segmentIndex:segment]; if (!value) { return YES; } return [value boolValue]; } #pragma mark Setters - (void)setSelectedSegmentIndex:(NSInteger)index { if (_selectedSegmentIndex == index) { return; } _selectedSegmentIndex = index; [self setNeedsDisplay]; [self sendActionsForControlEvents:UIControlEventValueChanged]; } #pragma mark Private Methods - (NSMutableDictionary *)_metaForSegmentIndex:(NSUInteger)index { if (!_segmentMeta) { return nil; } NSString *key = [NSString stringWithFormat:@"%lu", (unsigned long)index]; return [_segmentMeta objectForKey:key]; } - (id)_metaValueForKey:(NSString *)key segmentIndex:(NSUInteger)index { NSMutableDictionary *meta = [self _metaForSegmentIndex:index]; return [meta objectForKey:key]; } - (void)_setMetaValue:(id)value forKey:(NSString *)key segmentIndex:(NSUInteger)index { NSMutableDictionary *meta = [self _metaForSegmentIndex:index]; if (!meta) { meta = [NSMutableDictionary dictionary]; } [meta setValue:value forKey:key]; if (!_segmentMeta) { _segmentMeta = [[NSMutableDictionary alloc] init]; } [_segmentMeta setValue:meta forKey:[NSString stringWithFormat:@"%lu", (unsigned long)index]]; [self setNeedsDisplay]; } #pragma mark NSKeyValueObserving - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { if ([keyPath isEqualToString:@"buttonImage"] || [keyPath isEqualToString:@"highlightedButtonImage"] || [keyPath isEqualToString:@"dividerImage"] || [keyPath isEqualToString:@"highlightedDividerImage"] || [keyPath isEqualToString:@"font"] || [keyPath isEqualToString:@"textColor"] || [keyPath isEqualToString:@"textShadowColor"] || [keyPath isEqualToString:@"textShadowOffset"] || [keyPath isEqualToString:@"textEdgeInsets"]) { [self setNeedsDisplay]; return; } [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; } #pragma mark Appearance - (void)setTitleTextAttributes:(NSDictionary *)attributes forState:(UIControlState)state { } - (NSDictionary *)titleTextAttributesForState:(UIControlState)state { return nil; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UISlider.h ================================================ // // UISlider.h // UIKit // // Created by Peter Steinberger on 24.03.11. // /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIControl.h" @class UIImageView, UIImage; @interface UISlider : UIControl { float _value; float _minimumValue; float _maximumValue; } @property (nonatomic) float value; @property (nonatomic) float minimumValue; @property (nonatomic) float maximumValue; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UISlider.m ================================================ // // UISlider.m // UIKit // // Created by Peter Steinberger on 24.03.11. // /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UISlider.h" @implementation UISlider @synthesize value = _value; @synthesize minimumValue = _minimumValue; @synthesize maximumValue = _maximumValue; - (NSString *)description { return [NSString stringWithFormat:@"<%@: %p; frame = (%.0f %.0f; %.0f %.0f); opaque = %@; layer = %@; value = %f>", [self className], self, self.frame.origin.x, self.frame.origin.y, self.frame.size.width, self.frame.size.height, (self.opaque ? @"YES" : @"NO"), self.layer, self.value]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UISplitViewController.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIViewController.h" @protocol UISplitViewControllerDelegate; @interface UISplitViewController : UIViewController { @private __unsafe_unretained id _delegate; NSArray *_viewControllers; struct { unsigned willPresentViewController : 1; unsigned willHideViewController : 1; unsigned willShowViewController : 1; } _delegateHas; } @property (nonatomic, assign) id delegate; @property (nonatomic, copy) NSArray *viewControllers; @end @class UIPopoverController; @protocol UISplitViewControllerDelegate @optional - (void)splitViewController:(UISplitViewController*)svc popoverController:(UIPopoverController*)pc willPresentViewController:(UIViewController *)aViewController; - (void)splitViewController:(UISplitViewController*)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem*)barButtonItem forPopoverController:(UIPopoverController*)pc; - (void)splitViewController:(UISplitViewController*)svc willShowViewController:(UIViewController *)aViewController invalidatingBarButtonItem:(UIBarButtonItem *)button; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UISplitViewController.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UISplitViewController.h" #import "UIViewController+UIPrivate.h" #import "UIView.h" #import "UITouch.h" #import "UIColor.h" #import "UIResponderAppKitIntegration.h" #import static const CGFloat SplitterPadding = 3; @interface _UISplitViewControllerView : UIView { BOOL dragging; UIView *leftPanel; UIView *rightPanel; } @property (nonatomic, assign) CGFloat leftWidth; - (void)addViewControllers:(NSArray *)viewControllers; @end @implementation _UISplitViewControllerView - (id)initWithFrame:(CGRect)frame { if ((self=[super initWithFrame:frame])) { leftPanel = [[UIView alloc] initWithFrame:CGRectMake(0,0,320,frame.size.height)]; rightPanel = [[UIView alloc] initWithFrame:CGRectMake(321,0,MAX(0,frame.size.width-321),frame.size.height)]; leftPanel.clipsToBounds = rightPanel.clipsToBounds = YES; leftPanel.autoresizingMask = UIViewAutoresizingFlexibleHeight; rightPanel.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; [self addSubview:leftPanel]; [self addSubview:rightPanel]; self.backgroundColor = [UIColor blackColor]; } return self; } - (void)dealloc { [leftPanel release]; [rightPanel release]; [super dealloc]; } - (void)addViewControllers:(NSArray *)viewControllers { if ([viewControllers count] == 2) { UIView *leftView = [[viewControllers objectAtIndex:0] view]; UIView *rightView = [[viewControllers objectAtIndex:1] view]; leftView.autoresizingMask = rightView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; leftView.frame = leftPanel.bounds; rightView.frame = rightPanel.bounds; [leftPanel addSubview:leftView]; [rightPanel addSubview:rightView]; } } - (void)setLeftWidth:(CGFloat)newWidth { if (newWidth != leftPanel.frame.size.width) { CGRect leftFrame = leftPanel.frame; CGRect rightFrame = rightPanel.frame; const CGFloat height = self.bounds.size.height; leftFrame.origin = CGPointZero; leftFrame.size = CGSizeMake(newWidth, height); rightFrame.origin = CGPointMake(newWidth+1,0); rightFrame.size = CGSizeMake(MAX(self.bounds.size.width-newWidth-1,0), height); leftPanel.frame = leftFrame; rightPanel.frame = rightFrame; } } - (CGFloat)leftWidth { return CGRectGetMaxX(leftPanel.frame); } - (CGRect)splitterHitRect { return CGRectMake(self.leftWidth-SplitterPadding,0,SplitterPadding+SplitterPadding+1,self.bounds.size.height); } - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { if (CGRectContainsPoint([self splitterHitRect], point)) { return self; } else { return [super hitTest:point withEvent:event]; } } - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { CGPoint point = [[touches anyObject] locationInView:self]; if (CGRectContainsPoint([self splitterHitRect], point)) { dragging = YES; } } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { if (dragging) { CGFloat newWidth = [[touches anyObject] locationInView:self].x; newWidth = MAX(50, newWidth); newWidth = MIN(self.bounds.size.width-50, newWidth); self.leftWidth = newWidth; } } - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { dragging = NO; } - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { dragging = NO; } - (id)mouseCursorForEvent:(UIEvent *)event { CGRect splitterRect = [self splitterHitRect]; CGPoint point = [[[event allTouches] anyObject] locationInView:self]; if (dragging && point.x < splitterRect.origin.x) { return [NSCursor resizeLeftCursor]; } else if (dragging && point.x > splitterRect.origin.x+splitterRect.size.width) { return [NSCursor resizeRightCursor]; } else if (dragging || CGRectContainsPoint(splitterRect, point)) { return [NSCursor resizeLeftRightCursor]; } else { return [super mouseCursorForEvent:event]; } } @end @implementation UISplitViewController @synthesize delegate=_delegate, viewControllers=_viewControllers; - (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle { if ((self=[super initWithNibName:nibName bundle:nibBundle])) { } return self; } - (void)dealloc { [_viewControllers release]; [super dealloc]; } - (void)setDelegate:(id )newDelegate { _delegate = newDelegate; _delegateHas.willPresentViewController = [_delegate respondsToSelector:@selector(splitViewController:popoverController:willPresentViewController:)]; _delegateHas.willHideViewController = [_delegate respondsToSelector:@selector(splitViewController:willHideViewController:withBarButtonItem:forPopoverController:)]; _delegateHas.willShowViewController = [_delegate respondsToSelector:@selector(splitViewController:willShowViewController:invalidatingBarButtonItem:)]; } - (void)loadView { self.view = [[[_UISplitViewControllerView alloc] initWithFrame:CGRectMake(0,0,1024,768)] autorelease]; self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; } - (void)setViewControllers:(NSArray *)newControllers { assert([newControllers count]==2); if (![newControllers isEqualToArray:_viewControllers]) { for (UIViewController *c in _viewControllers) { [c _setParentViewController:nil]; } for (UIViewController *c in newControllers) { [c _setParentViewController:self]; } if ([self isViewLoaded]) { [(_UISplitViewControllerView *)self.view addViewControllers:_viewControllers]; for (UIViewController *c in newControllers) { [c viewWillAppear:NO]; } for (UIViewController *c in _viewControllers) { if ([c isViewLoaded]) { [c.view removeFromSuperview]; } } for (UIViewController *c in newControllers) { [c viewDidAppear:NO]; } } [_viewControllers release]; _viewControllers = [newControllers copy]; } } - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [(_UISplitViewControllerView *)self.view addViewControllers:_viewControllers]; for (UIViewController *c in _viewControllers) { [c viewWillAppear:animated]; } } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; for (UIViewController *c in _viewControllers) { [c viewDidAppear:animated]; } } - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; for (UIViewController *c in _viewControllers) { [c viewWillDisappear:animated]; } } - (void)viewDidDisappear:(BOOL)animated { [super viewDidDisappear:animated]; for (UIViewController *c in _viewControllers) { [c viewDidDisappear:animated]; } } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIStringDrawing.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import typedef enum { UILineBreakModeWordWrap = 0, UILineBreakModeCharacterWrap, UILineBreakModeClip, UILineBreakModeHeadTruncation, UILineBreakModeTailTruncation, UILineBreakModeMiddleTruncation, } UILineBreakMode; typedef enum { UITextAlignmentLeft, UITextAlignmentCenter, UITextAlignmentRight, } UITextAlignment; typedef enum { UIBaselineAdjustmentAlignBaselines, UIBaselineAdjustmentAlignCenters, UIBaselineAdjustmentNone, } UIBaselineAdjustment; extern NSString *const UITextAttributeFont; extern NSString *const UITextAttributeTextColor; extern NSString *const UITextAttributeTextShadowColor; extern NSString *const UITextAttributeTextShadowOffset; @class UIFont; @interface NSString (UIStringDrawing) - (CGSize)sizeWithFont:(UIFont *)font; - (CGSize)sizeWithFont:(UIFont *)font forWidth:(CGFloat)width lineBreakMode:(UILineBreakMode)lineBreakMode; - (CGSize)sizeWithFont:(UIFont *)font constrainedToSize:(CGSize)size; - (CGSize)sizeWithFont:(UIFont *)font constrainedToSize:(CGSize)size lineBreakMode:(UILineBreakMode)lineBreakMode; - (CGSize)drawAtPoint:(CGPoint)point withFont:(UIFont *)font; - (CGSize)drawAtPoint:(CGPoint)point forWidth:(CGFloat)width withFont:(UIFont *)font lineBreakMode:(UILineBreakMode)lineBreakMode; - (CGSize)drawAtPoint:(CGPoint)point forWidth:(CGFloat)width withFont:(UIFont *)font fontSize:(CGFloat)fontSize lineBreakMode:(UILineBreakMode)lineBreakMode baselineAdjustment:(UIBaselineAdjustment)baselineAdjustment; - (CGSize)drawInRect:(CGRect)rect withFont:(UIFont *)font; - (CGSize)drawInRect:(CGRect)rect withFont:(UIFont *)font lineBreakMode:(UILineBreakMode)lineBreakMode; - (CGSize)drawInRect:(CGRect)rect withFont:(UIFont *)font lineBreakMode:(UILineBreakMode)lineBreakMode alignment:(UITextAlignment)alignment; // not yet implemented - (CGSize)sizeWithFont:(UIFont *)font minFontSize:(CGFloat)minFontSize actualFontSize:(CGFloat *)actualFontSize forWidth:(CGFloat)width lineBreakMode:(UILineBreakMode)lineBreakMode; - (CGSize)drawAtPoint:(CGPoint)point forWidth:(CGFloat)width withFont:(UIFont *)font minFontSize:(CGFloat)minFontSize actualFontSize:(CGFloat *)actualFontSize lineBreakMode:(UILineBreakMode)lineBreakMode baselineAdjustment:(UIBaselineAdjustment)baselineAdjustment; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIStringDrawing.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIStringDrawing.h" #import "UIFont.h" #import #import "UIGraphics.h" NSString *const UITextAttributeFont = @"UITextAttributeFont"; NSString *const UITextAttributeTextColor = @"UITextAttributeTextColor"; NSString *const UITextAttributeTextShadowColor = @"UITextAttributeTextShadowColor"; NSString *const UITextAttributeTextShadowOffset = @"UITextAttributeTextShadowOffset"; static CFArrayRef CreateCTLinesForString(NSString *string, CGSize constrainedToSize, UIFont *font, UILineBreakMode lineBreakMode, CGSize *renderSize) { CFMutableArrayRef lines = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks); CGSize drawSize = CGSizeZero; if (font) { CFMutableDictionaryRef attributes = CFDictionaryCreateMutable(NULL, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); CFDictionarySetValue(attributes, kCTFontAttributeName,font->_font); CFDictionarySetValue(attributes, kCTForegroundColorFromContextAttributeName, kCFBooleanTrue); CFAttributedStringRef attributedString = CFAttributedStringCreate(NULL, (__bridge CFStringRef)string, attributes); CTTypesetterRef typesetter = CTTypesetterCreateWithAttributedString(attributedString); const CFIndex stringLength = CFAttributedStringGetLength(attributedString); const CGFloat lineHeight = font.lineHeight; const CGFloat capHeight = font.capHeight; CFIndex start = 0; BOOL isLastLine = NO; while (start < stringLength && !isLastLine) { drawSize.height += lineHeight; isLastLine = (drawSize.height+capHeight >= constrainedToSize.height); CFIndex usedCharacters = 0; CTLineRef line = NULL; if (isLastLine && (lineBreakMode != UILineBreakModeWordWrap && lineBreakMode != UILineBreakModeCharacterWrap)) { if (lineBreakMode == UILineBreakModeClip) { usedCharacters = CTTypesetterSuggestClusterBreak(typesetter, start, constrainedToSize.width); line = CTTypesetterCreateLine(typesetter, CFRangeMake(start, usedCharacters)); } else { CTLineTruncationType truncType; if (lineBreakMode == UILineBreakModeHeadTruncation) { truncType = kCTLineTruncationStart; } else if (lineBreakMode == UILineBreakModeTailTruncation) { truncType = kCTLineTruncationEnd; } else { truncType = kCTLineTruncationMiddle; } usedCharacters = stringLength - start; CFAttributedStringRef ellipsisString = CFAttributedStringCreate(NULL, CFSTR("…"), attributes); CTLineRef ellipsisLine = CTLineCreateWithAttributedString(ellipsisString); CTLineRef tempLine = CTTypesetterCreateLine(typesetter, CFRangeMake(start, usedCharacters)); line = CTLineCreateTruncatedLine(tempLine, constrainedToSize.width, truncType, ellipsisLine); CFRelease(tempLine); CFRelease(ellipsisLine); CFRelease(ellipsisString); } } else { if (lineBreakMode == UILineBreakModeCharacterWrap) { usedCharacters = CTTypesetterSuggestClusterBreak(typesetter, start, constrainedToSize.width); } else { usedCharacters = CTTypesetterSuggestLineBreak(typesetter, start, constrainedToSize.width); } line = CTTypesetterCreateLine(typesetter, CFRangeMake(start, usedCharacters)); } if (line) { drawSize.width = MAX(drawSize.width, ceilf(CTLineGetTypographicBounds(line,NULL,NULL,NULL))); CFArrayAppendValue(lines, line); CFRelease(line); } start += usedCharacters; } CFRelease(typesetter); CFRelease(attributedString); CFRelease(attributes); } if (renderSize) { *renderSize = drawSize; } return lines; } @implementation NSString (UIStringDrawing) - (CGSize)sizeWithFont:(UIFont *)font { return [self sizeWithFont:font constrainedToSize:CGSizeMake(CGFLOAT_MAX,font.lineHeight)]; } - (CGSize)sizeWithFont:(UIFont *)font forWidth:(CGFloat)width lineBreakMode:(UILineBreakMode)lineBreakMode { return [self sizeWithFont:font constrainedToSize:CGSizeMake(width,font.lineHeight) lineBreakMode:lineBreakMode]; } - (CGSize)sizeWithFont:(UIFont *)font minFontSize:(CGFloat)minFontSize actualFontSize:(CGFloat *)actualFontSize forWidth:(CGFloat)width lineBreakMode:(UILineBreakMode)lineBreakMode { return CGSizeZero; } - (CGSize)sizeWithFont:(UIFont *)font constrainedToSize:(CGSize)size lineBreakMode:(UILineBreakMode)lineBreakMode { CGSize resultingSize = CGSizeZero; CFArrayRef lines = CreateCTLinesForString(self, size, font, lineBreakMode, &resultingSize); if (lines) CFRelease(lines); return resultingSize; } - (CGSize)sizeWithFont:(UIFont *)font constrainedToSize:(CGSize)size { return [self sizeWithFont:font constrainedToSize:size lineBreakMode:UILineBreakModeWordWrap]; } - (CGSize)drawAtPoint:(CGPoint)point withFont:(UIFont *)font { return [self drawAtPoint:point forWidth:CGFLOAT_MAX withFont:font lineBreakMode:UILineBreakModeWordWrap]; } - (CGSize)drawAtPoint:(CGPoint)point forWidth:(CGFloat)width withFont:(UIFont *)font minFontSize:(CGFloat)minFontSize actualFontSize:(CGFloat *)actualFontSize lineBreakMode:(UILineBreakMode)lineBreakMode baselineAdjustment:(UIBaselineAdjustment)baselineAdjustment { return CGSizeZero; } - (CGSize)drawAtPoint:(CGPoint)point forWidth:(CGFloat)width withFont:(UIFont *)font fontSize:(CGFloat)fontSize lineBreakMode:(UILineBreakMode)lineBreakMode baselineAdjustment:(UIBaselineAdjustment)baselineAdjustment { UIFont *adjustedFont = ([font pointSize] != fontSize)? [font fontWithSize:fontSize] : font; return [self drawInRect:CGRectMake(point.x,point.y,width,adjustedFont.lineHeight) withFont:adjustedFont lineBreakMode:lineBreakMode]; } - (CGSize)drawAtPoint:(CGPoint)point forWidth:(CGFloat)width withFont:(UIFont *)font lineBreakMode:(UILineBreakMode)lineBreakMode { return [self drawAtPoint:point forWidth:width withFont:font fontSize:[font pointSize] lineBreakMode:lineBreakMode baselineAdjustment:UIBaselineAdjustmentNone]; } - (CGSize)drawInRect:(CGRect)rect withFont:(UIFont *)font lineBreakMode:(UILineBreakMode)lineBreakMode alignment:(UITextAlignment)alignment { CGSize actualSize = CGSizeZero; CFArrayRef lines = CreateCTLinesForString(self,rect.size,font,lineBreakMode,&actualSize); if (lines) { const CFIndex numberOfLines = CFArrayGetCount(lines); const CGFloat fontLineHeight = font.lineHeight; CGFloat textOffset = 0; CGContextRef ctx = UIGraphicsGetCurrentContext(); CGContextSaveGState(ctx); CGContextTranslateCTM(ctx, rect.origin.x, rect.origin.y+font.ascender); CGContextSetTextMatrix(ctx, CGAffineTransformMakeScale(1,-1)); for (CFIndex lineNumber=0; lineNumber @optional - (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item; // stub - (void)tabBar:(UITabBar *)tabBar willBeginCustomizingItems:(NSArray *)items; // called before customize sheet is shown. items is current item list - (void)tabBar:(UITabBar *)tabBar didBeginCustomizingItems:(NSArray *)items; // called after customize sheet is shown. items is current item list - (void)tabBar:(UITabBar *)tabBar willEndCustomizingItems:(NSArray *)items changed:(BOOL)changed; // called before customize sheet is hidden. items is new item list - (void)tabBar:(UITabBar *)tabBar didEndCustomizingItems:(NSArray *)items changed:(BOOL)changed; // called after customize sheet is hidden. items is new item list @end @interface UITabBar : UIView { __unsafe_unretained id _delegate; NSArray *_items; NSInteger _selectedItemIndex; } @property (nonatomic, assign) id delegate; @property (nonatomic, copy) NSArray *items; @property (nonatomic, assign) UITabBarItem *selectedItem; - (void)setItems:(NSArray *)items animated:(BOOL)animated; // stub - (void)beginCustomizingItems:(NSArray *)items; - (BOOL)endCustomizingAnimated:(BOOL)animated; - (BOOL)isCustomizing; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UITabBar.m ================================================ // // UITabBar.m // UIKit // // Created by Peter Steinberger on 23.03.11. // /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UITabBar.h" #import "UIImageView.h" #import "UIImage+UIPrivate.h" #import #define TABBAR_HEIGHT 60.0 @implementation UITabBar @synthesize items = _items, delegate = _delegate; - (id)initWithFrame:(CGRect)rect { if ((self = [super initWithFrame:rect])) { rect.size.height = TABBAR_HEIGHT; // tabbar is always fixed _selectedItemIndex = -1; UIImage *backgroundImage = [UIImage _popoverBackgroundImage]; UIImageView *backgroundView = [[[UIImageView alloc] initWithImage:backgroundImage] autorelease]; backgroundView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; backgroundView.frame = rect; [self addSubview:backgroundView]; } return self; } - (void)dealloc { _delegate = nil; [_items release]; [super dealloc]; } - (UITabBarItem *)selectedItem { if (_selectedItemIndex >= 0) { return [_items objectAtIndex:_selectedItemIndex]; } return nil; } - (void)setSelectedItem:(UITabBarItem *)selectedItem { } - (void)setItems:(NSArray *)items animated:(BOOL)animated { } - (void)beginCustomizingItems:(NSArray *)items { } - (BOOL)endCustomizingAnimated:(BOOL)animated { return YES; } - (BOOL)isCustomizing { return NO; } - (NSString *)description { return [NSString stringWithFormat:@"<%@: %p; selectedItem = %@; items = %@; delegate = %@>", [self className], self, self.selectedItem, self.items, self.delegate]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UITabBarController.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIViewController.h" @class UITabBarController; @protocol UITabBarControllerDelegate - (void)tabBarController:(UITabBarController *)tabBarController didEndCustomizingViewControllers:(NSArray *)viewControllers changed:(BOOL)changed; - (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController; - (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController; - (void)tabBarController:(UITabBarController *)tabBarController willBeginCustomizingViewControllers:(NSArray *)viewControllers; - (void)tabBarController:(UITabBarController *)tabBarController willEndCustomizingViewControllers:(NSArray *)viewControllers changed:(BOOL)changed; @end @class UITabBar; @interface UITabBarController : UIViewController { UITabBar *_tabBar; __unsafe_unretained UIViewController *_selectedViewController; NSArray *_viewControllers; NSUInteger _selectedIndex; } - (void)setViewControllers:(NSArray *)viewController animated:(BOOL)animated; @property (nonatomic, assign) UIViewController *selectedViewController; @property (nonatomic, copy) NSArray *viewControllers; @property (nonatomic, assign) NSUInteger selectedIndex; @property (nonatomic, readonly) UITabBar *tabBar; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UITabBarController.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UITabBarController.h" #import "UITabBar.h" @implementation UITabBarController @synthesize selectedViewController = _selectedViewController; @synthesize viewControllers = _viewControllers; @synthesize selectedIndex = _selectedIndex; @synthesize tabBar = _tabBar; - (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle { if ((self = [super initWithNibName:nibName bundle:nibBundle])) { _tabBar = [[UITabBar alloc] initWithFrame:CGRectZero]; } return self; } - (void)dealloc { [_tabBar release]; [super dealloc]; } - (void)setViewControllers:(NSArray *)viewController animated:(BOOL)animated { } - (NSString *)description { return [NSString stringWithFormat:@"<%@: %p; selectedViewController = %@; viewControllers = %@; selectedIndex = %lu; tabBar = %@>", [self className], self, self.selectedViewController, self.viewControllers, (unsigned long)self.selectedIndex, self.tabBar]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UITabBarItem.h ================================================ // // UITabBarItem.h // UIKit // // Created by Peter Steinberger on 23.03.11. // /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIBarItem.h" @class UIImage; typedef enum { UITabBarSystemItemMore, UITabBarSystemItemFavorites, UITabBarSystemItemFeatured, UITabBarSystemItemTopRated, UITabBarSystemItemRecents, UITabBarSystemItemContacts, UITabBarSystemItemHistory, UITabBarSystemItemBookmarks, UITabBarSystemItemSearch, UITabBarSystemItemDownloads, UITabBarSystemItemMostRecent, UITabBarSystemItemMostViewed, } UITabBarSystemItem; @interface UITabBarItem : UIBarItem { NSString *_badgeValue; } - (id)initWithTitle:(NSString *)title image:(UIImage *)image tag:(NSInteger)tag; - (id)initWithTabBarSystemItem:(UITabBarSystemItem)systemItem tag:(NSInteger)tag; @property (nonatomic, copy) NSString *badgeValue; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UITabBarItem.m ================================================ // // UITabBarItem.m // UIKit // // Created by Peter Steinberger on 23.03.11. // /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UITabBarItem.h" #import "UIImage.h" @implementation UITabBarItem @synthesize badgeValue=_badgeValue; - (id)initWithTitle:(NSString *)title image:(UIImage *)image tag:(NSInteger)tag { if ((self = [super init])) { self.title = title; self.image = image; } return self; } - (id)initWithTabBarSystemItem:(UITabBarSystemItem)systemItem tag:(NSInteger)tag { if ((self = [super init])) { } return self; } - (void)dealloc { [_badgeValue release]; [super dealloc]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UITableView.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIScrollView.h" #import "UITableViewCell.h" #import "NSIndexPath+UITableView.h" extern NSString *const UITableViewIndexSearch; @class UITableView; @protocol UITableViewDelegate @optional - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath; - (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath; - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath; - (NSIndexPath *)tableView:(UITableView *)tableView willDeselectRowAtIndexPath:(NSIndexPath *)indexPath; - (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath; - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section; - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section; - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section; - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section; - (void)tableView:(UITableView *)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath; - (void)tableView:(UITableView *)tableView didEndEditingRowAtIndexPath:(NSIndexPath *)indexPath; - (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath; @end @protocol UITableViewDataSource @required - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section; - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath; @optional - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView; - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section; - (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section; - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath; - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath; @end typedef enum { UITableViewStylePlain, UITableViewStyleGrouped } UITableViewStyle; typedef enum { UITableViewScrollPositionNone, UITableViewScrollPositionTop, UITableViewScrollPositionMiddle, UITableViewScrollPositionBottom } UITableViewScrollPosition; typedef enum { UITableViewRowAnimationFade, UITableViewRowAnimationRight, UITableViewRowAnimationLeft, UITableViewRowAnimationTop, UITableViewRowAnimationBottom, UITableViewRowAnimationNone, UITableViewRowAnimationMiddle } UITableViewRowAnimation; @interface UITableView : UIScrollView { @private UITableViewStyle _style; __unsafe_unretained id _dataSource; BOOL _needsReload; CGFloat _rowHeight; UIColor *_separatorColor; UITableViewCellSeparatorStyle _separatorStyle; UIView *_tableHeaderView; UIView *_tableFooterView; UIView *_backgroundView; BOOL _allowsSelection; BOOL _allowsSelectionDuringEditing; BOOL _editing; NSIndexPath *_selectedRow; NSIndexPath *_highlightedRow; NSMutableDictionary *_cachedCells; NSMutableSet *_reusableCells; NSMutableArray *_sections; CGFloat _sectionHeaderHeight; CGFloat _sectionFooterHeight; struct { unsigned heightForRowAtIndexPath : 1; unsigned heightForHeaderInSection : 1; unsigned heightForFooterInSection : 1; unsigned viewForHeaderInSection : 1; unsigned viewForFooterInSection : 1; unsigned willSelectRowAtIndexPath : 1; unsigned didSelectRowAtIndexPath : 1; unsigned willDeselectRowAtIndexPath : 1; unsigned didDeselectRowAtIndexPath : 1; unsigned willBeginEditingRowAtIndexPath : 1; unsigned didEndEditingRowAtIndexPath : 1; unsigned titleForDeleteConfirmationButtonForRowAtIndexPath: 1; } _delegateHas; struct { unsigned numberOfSectionsInTableView : 1; unsigned titleForHeaderInSection : 1; unsigned titleForFooterInSection : 1; unsigned commitEditingStyle : 1; unsigned canEditRowAtIndexPath : 1; } _dataSourceHas; } - (id)initWithFrame:(CGRect)frame style:(UITableViewStyle)style; - (void)reloadData; - (NSInteger)numberOfSections; - (NSInteger)numberOfRowsInSection:(NSInteger)section; - (NSArray *)indexPathsForRowsInRect:(CGRect)rect; - (NSIndexPath *)indexPathForRowAtPoint:(CGPoint)point; - (NSIndexPath *)indexPathForCell:(UITableViewCell *)cell; - (NSArray *)indexPathsForVisibleRows; - (NSArray *)visibleCells; - (UITableViewCell *)dequeueReusableCellWithIdentifier:(NSString *)identifier; - (UITableViewCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath; - (CGRect)rectForSection:(NSInteger)section; - (CGRect)rectForHeaderInSection:(NSInteger)section; - (CGRect)rectForFooterInSection:(NSInteger)section; - (CGRect)rectForRowAtIndexPath:(NSIndexPath *)indexPath; - (void)beginUpdates; - (void)endUpdates; - (void)insertSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation; - (void)deleteSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation; - (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation; // not implemented - (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation; // not implemented - (NSIndexPath *)indexPathForSelectedRow; - (void)deselectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated; - (void)selectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UITableViewScrollPosition)scrollPosition; - (void)scrollToNearestSelectedRowAtScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated; - (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated; - (void)setEditing:(BOOL)editing animated:(BOOL)animate; @property (nonatomic, readonly) UITableViewStyle style; @property (nonatomic, assign) id delegate; @property (nonatomic, assign) id dataSource; @property (nonatomic) CGFloat rowHeight; @property (nonatomic) UITableViewCellSeparatorStyle separatorStyle; @property (nonatomic, strong) UIColor *separatorColor; @property (nonatomic, strong) UIView *tableHeaderView; @property (nonatomic, strong) UIView *tableFooterView; @property (nonatomic, strong) UIView *backgroundView; @property (nonatomic) BOOL allowsSelection; @property (nonatomic) BOOL allowsSelectionDuringEditing; // not implemented @property (nonatomic, getter=isEditing) BOOL editing; @property (nonatomic) CGFloat sectionHeaderHeight; @property (nonatomic) CGFloat sectionFooterHeight; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UITableView.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UITableView.h" #import "UITableViewCell+UIPrivate.h" #import "UIColor.h" #import "UITouch.h" #import "UITableViewSection.h" #import "UITableViewSectionLabel.h" #import "UIScreenAppKitIntegration.h" #import "UIWindow.h" #import "UIKitView.h" #import "UIApplication+UIPrivate.h" #import #import #import // http://stackoverflow.com/questions/235120/whats-the-uitableview-index-magnifying-glass-character NSString *const UITableViewIndexSearch = @"{search}"; const CGFloat _UITableViewDefaultRowHeight = 43; @interface UITableView () - (void)_setNeedsReload; @end @implementation UITableView @synthesize style=_style, dataSource=_dataSource, rowHeight=_rowHeight, separatorStyle=_separatorStyle, separatorColor=_separatorColor; @synthesize tableHeaderView=_tableHeaderView, tableFooterView=_tableFooterView, allowsSelection=_allowsSelection, editing=_editing; @synthesize sectionFooterHeight=_sectionFooterHeight, sectionHeaderHeight=_sectionHeaderHeight; @synthesize allowsSelectionDuringEditing=_allowsSelectionDuringEditing, backgroundView=_backgroundView; @dynamic delegate; - (id)initWithFrame:(CGRect)frame { return [self initWithFrame:frame style:UITableViewStylePlain]; } - (id)initWithFrame:(CGRect)frame style:(UITableViewStyle)theStyle { if ((self=[super initWithFrame:frame])) { _style = theStyle; _cachedCells = [[NSMutableDictionary alloc] init]; _sections = [[NSMutableArray alloc] init]; _reusableCells = [[NSMutableSet alloc] init]; self.separatorColor = [UIColor colorWithRed:.88f green:.88f blue:.88f alpha:1]; self.separatorStyle = UITableViewCellSeparatorStyleSingleLine; self.showsHorizontalScrollIndicator = NO; self.allowsSelection = YES; self.allowsSelectionDuringEditing = NO; self.sectionHeaderHeight = self.sectionFooterHeight = 22; self.alwaysBounceVertical = YES; if (_style == UITableViewStylePlain) { self.backgroundColor = [UIColor whiteColor]; } [self _setNeedsReload]; } return self; } - (void)dealloc { [_selectedRow release]; [_highlightedRow release]; [_tableFooterView release]; [_tableHeaderView release]; [_cachedCells release]; [_sections release]; [_reusableCells release]; [_separatorColor release]; [super dealloc]; } - (void)setDataSource:(id)newSource { _dataSource = newSource; _dataSourceHas.numberOfSectionsInTableView = [_dataSource respondsToSelector:@selector(numberOfSectionsInTableView:)]; _dataSourceHas.titleForHeaderInSection = [_dataSource respondsToSelector:@selector(tableView:titleForHeaderInSection:)]; _dataSourceHas.titleForFooterInSection = [_dataSource respondsToSelector:@selector(tableView:titleForFooterInSection:)]; _dataSourceHas.commitEditingStyle = [_dataSource respondsToSelector:@selector(tableView:commitEditingStyle:forRowAtIndexPath:)]; _dataSourceHas.canEditRowAtIndexPath = [_dataSource respondsToSelector:@selector(tableView:canEditRowAtIndexPath:)]; [self _setNeedsReload]; } - (void)setDelegate:(id)newDelegate { [super setDelegate:newDelegate]; _delegateHas.heightForRowAtIndexPath = [_delegate respondsToSelector:@selector(tableView:heightForRowAtIndexPath:)]; _delegateHas.heightForHeaderInSection = [_delegate respondsToSelector:@selector(tableView:heightForHeaderInSection:)]; _delegateHas.heightForFooterInSection = [_delegate respondsToSelector:@selector(tableView:heightForFooterInSection:)]; _delegateHas.viewForHeaderInSection = [_delegate respondsToSelector:@selector(tableView:viewForHeaderInSection:)]; _delegateHas.viewForFooterInSection = [_delegate respondsToSelector:@selector(tableView:viewForFooterInSection:)]; _delegateHas.willSelectRowAtIndexPath = [_delegate respondsToSelector:@selector(tableView:willSelectRowAtIndexPath:)]; _delegateHas.didSelectRowAtIndexPath = [_delegate respondsToSelector:@selector(tableView:didSelectRowAtIndexPath:)]; _delegateHas.willDeselectRowAtIndexPath = [_delegate respondsToSelector:@selector(tableView:willDeselectRowAtIndexPath:)]; _delegateHas.didDeselectRowAtIndexPath = [_delegate respondsToSelector:@selector(tableView:didDeselectRowAtIndexPath:)]; _delegateHas.willBeginEditingRowAtIndexPath = [_delegate respondsToSelector:@selector(tableView:willBeginEditingRowAtIndexPath:)]; _delegateHas.didEndEditingRowAtIndexPath = [_delegate respondsToSelector:@selector(tableView:didEndEditingRowAtIndexPath:)]; _delegateHas.titleForDeleteConfirmationButtonForRowAtIndexPath = [_delegate respondsToSelector:@selector(tableView:titleForDeleteConfirmationButtonForRowAtIndexPath:)]; } - (void)setRowHeight:(CGFloat)newHeight { _rowHeight = newHeight; [self setNeedsLayout]; } - (void)_updateSectionsCache { // uses the dataSource to rebuild the cache. // if there's no dataSource, this can't do anything else. // note that I'm presently caching and hanging on to views and titles for section headers which is something // the real UIKit appears to fetch more on-demand than this. so far this has not been a problem. // remove all previous section header/footer views for (UITableViewSection *previousSectionRecord in _sections) { [previousSectionRecord.headerView removeFromSuperview]; [previousSectionRecord.footerView removeFromSuperview]; } // clear the previous cache [_sections removeAllObjects]; if (_dataSource) { // compute the heights/offsets of everything const CGFloat defaultRowHeight = _rowHeight ?: _UITableViewDefaultRowHeight; const NSInteger numberOfSections = [self numberOfSections]; for (NSInteger section=0; section 0) { UITableViewCell *cell = [availableCells objectForKey:indexPath] ?: [self.dataSource tableView:self cellForRowAtIndexPath:indexPath]; if (cell) { [_cachedCells setObject:cell forKey:indexPath]; [availableCells removeObjectForKey:indexPath]; cell.highlighted = [_highlightedRow isEqual:indexPath]; cell.selected = [_selectedRow isEqual:indexPath]; cell.frame = rowRect; cell.backgroundColor = self.backgroundColor; [cell _setSeparatorStyle:_separatorStyle color:_separatorColor]; [self addSubview:cell]; } } } } } // remove old cells, but save off any that might be reusable for (UITableViewCell *cell in [availableCells allValues]) { if (cell.reuseIdentifier) { [_reusableCells addObject:cell]; } else { [cell removeFromSuperview]; } } // non-reusable cells should end up dealloced after at this point, but reusable ones live on in _reusableCells. [availableCells release]; // now make sure that all available (but unused) reusable cells aren't on screen in the visible area. // this is done becaue when resizing a table view by shrinking it's height in an animation, it looks better. The reason is that // when an animation happens, it sets the frame to the new (shorter) size and thus recalcuates which cells should be visible. // If it removed all non-visible cells, then the cells on the bottom of the table view would disappear immediately but before // the frame of the table view has actually animated down to the new, shorter size. So the animation is jumpy/ugly because // the cells suddenly disappear instead of seemingly animating down and out of view like they should. This tries to leave them // on screen as long as possible, but only if they don't get in the way. NSArray* allCachedCells = [_cachedCells allValues]; for (UITableViewCell *cell in _reusableCells) { if (CGRectIntersectsRect(cell.frame,visibleBounds) && ![allCachedCells containsObject: cell]) { [cell removeFromSuperview]; } } if (_tableFooterView) { CGRect tableFooterFrame = _tableFooterView.frame; tableFooterFrame.origin = CGPointMake(0,tableHeight); tableFooterFrame.size.width = boundsSize.width; _tableFooterView.frame = tableFooterFrame; } } - (CGRect)_CGRectFromVerticalOffset:(CGFloat)offset height:(CGFloat)height { return CGRectMake(0,offset,self.bounds.size.width,height); } - (CGFloat)_offsetForSection:(NSInteger)index { CGFloat offset = _tableHeaderView? _tableHeaderView.frame.size.height : 0; for (NSInteger s=0; s= rect.origin.y) { for (NSInteger row=0; row rect.origin.y+rect.size.height) { break; // don't need to find anything else.. we are past the end } offset += height; } } else { offset += sectionRecord.rowsHeight; } offset += sectionRecord.footerHeight; } return [results autorelease]; } - (NSIndexPath *)indexPathForRowAtPoint:(CGPoint)point { NSArray *paths = [self indexPathsForRowsInRect:CGRectMake(point.x,point.y,1,1)]; return ([paths count] > 0)? [paths objectAtIndex:0] : nil; } - (NSArray *)indexPathsForVisibleRows { [self _layoutTableView]; NSMutableArray *indexes = [NSMutableArray arrayWithCapacity:[_cachedCells count]]; const CGRect bounds = self.bounds; // Special note - it's unclear if UIKit returns these in sorted order. Because we're assuming that visibleCells returns them in order (top-bottom) // and visibleCells uses this method, I'm going to make the executive decision here and assume that UIKit probably does return them sorted - since // there's nothing warning that they aren't. :) for (NSIndexPath *indexPath in [[_cachedCells allKeys] sortedArrayUsingSelector:@selector(compare:)]) { if (CGRectIntersectsRect(bounds,[self rectForRowAtIndexPath:indexPath])) { [indexes addObject:indexPath]; } } return indexes; } - (NSArray *)visibleCells { NSMutableArray *cells = [[[NSMutableArray alloc] init] autorelease]; for (NSIndexPath *index in [self indexPathsForVisibleRows]) { UITableViewCell *cell = [self cellForRowAtIndexPath:index]; if (cell) { [cells addObject:cell]; } } return cells; } - (void)setTableHeaderView:(UIView *)newHeader { if (newHeader != _tableHeaderView) { [_tableHeaderView removeFromSuperview]; [_tableHeaderView release]; _tableHeaderView = [newHeader retain]; [self _setContentSize]; [self addSubview:_tableHeaderView]; } } - (void)setTableFooterView:(UIView *)newFooter { if (newFooter != _tableFooterView) { [_tableFooterView removeFromSuperview]; [_tableFooterView release]; _tableFooterView = [newFooter retain]; [self _setContentSize]; [self addSubview:_tableFooterView]; } } - (void)setBackgroundView:(UIView *)backgroundView { if (_backgroundView != backgroundView) { [_backgroundView removeFromSuperview]; [_backgroundView release]; _backgroundView = [backgroundView retain]; [self insertSubview:_backgroundView atIndex:0]; } } - (NSInteger)numberOfSections { if (_dataSourceHas.numberOfSectionsInTableView) { return [self.dataSource numberOfSectionsInTableView:self]; } else { return 1; } } - (NSInteger)numberOfRowsInSection:(NSInteger)section { return [self.dataSource tableView:self numberOfRowsInSection:section]; } - (void)reloadData { // clear the caches and remove the cells since everything is going to change [[_cachedCells allValues] makeObjectsPerformSelector:@selector(removeFromSuperview)]; [_reusableCells makeObjectsPerformSelector:@selector(removeFromSuperview)]; [_reusableCells removeAllObjects]; [_cachedCells removeAllObjects]; // clear prior selection [_selectedRow release]; _selectedRow = nil; [_highlightedRow release]; _highlightedRow = nil; // trigger the section cache to be repopulated [self _updateSectionsCache]; [self _setContentSize]; _needsReload = NO; } - (void)_reloadDataIfNeeded { if (_needsReload) { [self reloadData]; } } - (void)_setNeedsReload { _needsReload = YES; [self setNeedsLayout]; } - (void)layoutSubviews { _backgroundView.frame = self.bounds; [self _reloadDataIfNeeded]; [self _layoutTableView]; [super layoutSubviews]; } - (void)setFrame:(CGRect)frame { const CGRect oldFrame = self.frame; if (!CGRectEqualToRect(oldFrame,frame)) { [super setFrame:frame]; if (oldFrame.size.width != frame.size.width) { [self _updateSectionsCache]; } [self _setContentSize]; } } - (NSIndexPath *)indexPathForSelectedRow { return [[_selectedRow retain] autorelease]; } - (NSIndexPath *)indexPathForCell:(UITableViewCell *)cell { for (NSIndexPath *index in [_cachedCells allKeys]) { if ([_cachedCells objectForKey:index] == cell) { return [[index retain] autorelease]; } } return nil; } - (void)deselectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated { if (indexPath && [indexPath isEqual:_selectedRow]) { [self cellForRowAtIndexPath:_selectedRow].selected = NO; [_selectedRow release]; _selectedRow = nil; } } - (void)selectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UITableViewScrollPosition)scrollPosition { // unlike the other methods that I've tested, the real UIKit appears to call reload during selection if the table hasn't been reloaded // yet. other methods all appear to rebuild the section cache "on-demand" but don't do a "proper" reload. for the sake of attempting // to maintain a similar delegate and dataSource access pattern to the real thing, I'll do it this way here. :) [self _reloadDataIfNeeded]; if (![_selectedRow isEqual:indexPath]) { [self deselectRowAtIndexPath:_selectedRow animated:animated]; [_selectedRow release]; _selectedRow = [indexPath retain]; [self cellForRowAtIndexPath:_selectedRow].selected = YES; } // I did not verify if the real UIKit will still scroll the selection into view even if the selection itself doesn't change. // this behavior was useful for Ostrich and seems harmless enough, so leaving it like this for now. [self scrollToRowAtIndexPath:_selectedRow atScrollPosition:scrollPosition animated:animated]; } - (void)_scrollRectToVisible:(CGRect)aRect atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated { if (!CGRectIsNull(aRect) && aRect.size.height > 0) { // adjust the rect based on the desired scroll position setting switch (scrollPosition) { case UITableViewScrollPositionNone: break; case UITableViewScrollPositionTop: aRect.size.height = self.bounds.size.height; break; case UITableViewScrollPositionMiddle: aRect.origin.y -= (self.bounds.size.height / 2.f) - aRect.size.height; aRect.size.height = self.bounds.size.height; break; case UITableViewScrollPositionBottom: aRect.origin.y -= self.bounds.size.height - aRect.size.height; aRect.size.height = self.bounds.size.height; break; } [self scrollRectToVisible:aRect animated:animated]; } } - (void)scrollToNearestSelectedRowAtScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated { [self _scrollRectToVisible:[self rectForRowAtIndexPath:[self indexPathForSelectedRow]] atScrollPosition:scrollPosition animated:animated]; } - (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated { [self _scrollRectToVisible:[self rectForRowAtIndexPath:indexPath] atScrollPosition:scrollPosition animated:animated]; } - (UITableViewCell *)dequeueReusableCellWithIdentifier:(NSString *)identifier { for (UITableViewCell *cell in _reusableCells) { if ([cell.reuseIdentifier isEqualToString:identifier]) { [cell retain]; [_reusableCells removeObject:cell]; [cell prepareForReuse]; return [cell autorelease]; } } return nil; } - (void)setEditing:(BOOL)editing animated:(BOOL)animate { _editing = editing; } - (void)setEditing:(BOOL)editing { [self setEditing:editing animated:NO]; } - (void)insertSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation { [self reloadData]; } - (void)deleteSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation { [self reloadData]; } - (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation { [self reloadData]; } - (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation { [self reloadData]; } - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { if (!_highlightedRow) { UITouch *touch = [touches anyObject]; const CGPoint location = [touch locationInView:self]; _highlightedRow = [[self indexPathForRowAtPoint:location] retain]; [self cellForRowAtIndexPath:_highlightedRow].highlighted = YES; } } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { // this isn't quite how iOS seems to do it, but I think it makes sense on OSX if (_highlightedRow) { UITouch *touch = [touches anyObject]; const CGPoint location = [touch locationInView:self]; if (!CGRectContainsPoint([self rectForRowAtIndexPath:_highlightedRow], location)) { [self cellForRowAtIndexPath:_highlightedRow].highlighted = NO; [_highlightedRow release]; _highlightedRow = nil; } } } - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { if (_highlightedRow) { NSIndexPath *selectedRow = [self indexPathForSelectedRow]; if (selectedRow) { NSIndexPath *rowToDeselect = selectedRow; if (_delegateHas.willDeselectRowAtIndexPath) { rowToDeselect = [_delegate tableView:self willDeselectRowAtIndexPath:rowToDeselect]; } [self deselectRowAtIndexPath:rowToDeselect animated:NO]; if (_delegateHas.didDeselectRowAtIndexPath) { [_delegate tableView:self didDeselectRowAtIndexPath:rowToDeselect]; } } NSIndexPath *rowToSelect = _highlightedRow; if (_delegateHas.willSelectRowAtIndexPath) { rowToSelect = [_delegate tableView:self willSelectRowAtIndexPath:rowToSelect]; } [self cellForRowAtIndexPath:_highlightedRow].highlighted = NO; [self selectRowAtIndexPath:rowToSelect animated:NO scrollPosition:UITableViewScrollPositionNone]; if (_delegateHas.didSelectRowAtIndexPath) { [_delegate tableView:self didSelectRowAtIndexPath:rowToSelect]; } [_highlightedRow release]; _highlightedRow = nil; } } - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { if (_highlightedRow) { [self cellForRowAtIndexPath:_highlightedRow].highlighted = NO; [_highlightedRow release]; _highlightedRow = nil; } } - (BOOL)_canEditRowAtIndexPath:(NSIndexPath *)indexPath { // it's YES by default until the dataSource overrules return _dataSourceHas.commitEditingStyle && (!_dataSourceHas.canEditRowAtIndexPath || [_dataSource tableView:self canEditRowAtIndexPath:indexPath]); } - (void)_beginEditingRowAtIndexPath:(NSIndexPath *)indexPath { if ([self _canEditRowAtIndexPath:indexPath]) { self.editing = YES; if (_delegateHas.willBeginEditingRowAtIndexPath) { [_delegate tableView:self willBeginEditingRowAtIndexPath:indexPath]; } // deferring this because it presents a modal menu and that's what we do everywhere else in Chameleon [self performSelector:@selector(_showEditMenuForRowAtIndexPath:) withObject:indexPath afterDelay:0]; } } - (void)_endEditingRowAtIndexPath:(NSIndexPath *)indexPath { if (self.editing) { self.editing = NO; if (_delegateHas.didEndEditingRowAtIndexPath) { [_delegate tableView:self didEndEditingRowAtIndexPath:indexPath]; } } } - (void)_showEditMenuForRowAtIndexPath:(NSIndexPath *)indexPath { // re-checking for safety since _showEditMenuForRowAtIndexPath is deferred. this may be overly paranoid. if ([self _canEditRowAtIndexPath:indexPath]) { UITableViewCell *cell = [self cellForRowAtIndexPath:indexPath]; NSString *menuItemTitle = nil; // fetch the title for the delete menu item if (_delegateHas.titleForDeleteConfirmationButtonForRowAtIndexPath) { menuItemTitle = [_delegate tableView:self titleForDeleteConfirmationButtonForRowAtIndexPath:indexPath]; } if ([menuItemTitle length] == 0) { menuItemTitle = @"Delete"; } cell.highlighted = YES; NSMenuItem *theItem = [[NSMenuItem alloc] initWithTitle:menuItemTitle action:NULL keyEquivalent:@""]; NSMenu *menu = [[NSMenu alloc] initWithTitle:@""]; [menu setAutoenablesItems:NO]; [menu setAllowsContextMenuPlugIns:NO]; [menu addItem:theItem]; // calculate the mouse's current position so we can present the menu from there since that's normal OSX behavior NSPoint mouseLocation = [NSEvent mouseLocation]; CGPoint screenPoint = [self.window.screen convertPoint:NSPointToCGPoint(mouseLocation) fromScreen:nil]; // modally present a menu with the single delete option on it, if it was selected, then do the delete, otherwise do nothing const BOOL didSelectItem = [menu popUpMenuPositioningItem:nil atLocation:NSPointFromCGPoint(screenPoint) inView:[self.window.screen UIKitView]]; [menu release]; [theItem release]; [[UIApplication sharedApplication] _cancelTouches]; if (didSelectItem) { [_dataSource tableView:self commitEditingStyle:UITableViewCellEditingStyleDelete forRowAtIndexPath:indexPath]; } cell.highlighted = NO; } // all done [self _endEditingRowAtIndexPath:indexPath]; } - (void)rightClick:(UITouch *)touch withEvent:(UIEvent *)event { CGPoint location = [touch locationInView:self]; NSIndexPath *touchedRow = [self indexPathForRowAtPoint:location]; // this is meant to emulate UIKit's swipe-to-delete feature on Mac by way of a right-click menu if (touchedRow && [self _canEditRowAtIndexPath:touchedRow]) { [self _beginEditingRowAtIndexPath:touchedRow]; } } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UITableViewCell+UIPrivate.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UITableViewCell.h" @interface UITableViewCell (UIPrivate) - (void)_setSeparatorStyle:(UITableViewCellSeparatorStyle)theStyle color:(UIColor *)theColor; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UITableViewCell.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIView.h" typedef enum { UITableViewCellAccessoryNone, UITableViewCellAccessoryDisclosureIndicator, UITableViewCellAccessoryDetailDisclosureButton, UITableViewCellAccessoryCheckmark } UITableViewCellAccessoryType; typedef enum { UITableViewCellSeparatorStyleNone, UITableViewCellSeparatorStyleSingleLine, UITableViewCellSeparatorStyleSingleLineEtched } UITableViewCellSeparatorStyle; typedef enum { UITableViewCellStyleDefault, UITableViewCellStyleValue1, UITableViewCellStyleValue2, UITableViewCellStyleSubtitle } UITableViewCellStyle; typedef enum { UITableViewCellSelectionStyleNone, UITableViewCellSelectionStyleBlue, UITableViewCellSelectionStyleGray } UITableViewCellSelectionStyle; typedef enum { UITableViewCellEditingStyleNone, UITableViewCellEditingStyleDelete, UITableViewCellEditingStyleInsert } UITableViewCellEditingStyle; @class UITableViewCellSeparator, UILabel, UIImageView; @interface UITableViewCell : UIView { @private UITableViewCellStyle _style; UITableViewCellSeparator *_seperatorView; UIView *_contentView; UILabel *_textLabel; UILabel *_detailTextLabel; // not yet displayed! UIImageView *_imageView; UIView *_backgroundView; UIView *_selectedBackgroundView; UITableViewCellAccessoryType _accessoryType; UIView *_accessoryView; UITableViewCellAccessoryType _editingAccessoryType; UITableViewCellSelectionStyle _selectionStyle; NSInteger _indentationLevel; BOOL _editing; BOOL _selected; BOOL _highlighted; BOOL _showingDeleteConfirmation; NSString *_reuseIdentifier; CGFloat _indentationWidth; } - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier; - (void)setSelected:(BOOL)selected animated:(BOOL)animated; - (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated; - (void)prepareForReuse; @property (nonatomic, readonly, strong) UIView *contentView; @property (nonatomic, readonly, strong) UILabel *textLabel; @property (nonatomic, readonly, strong) UILabel *detailTextLabel; @property (nonatomic, readonly, strong) UIImageView *imageView; @property (nonatomic, strong) UIView *backgroundView; @property (nonatomic, strong) UIView *selectedBackgroundView; @property (nonatomic) UITableViewCellSelectionStyle selectionStyle; @property (nonatomic) NSInteger indentationLevel; @property (nonatomic) UITableViewCellAccessoryType accessoryType; @property (nonatomic, strong) UIView *accessoryView; @property (nonatomic) UITableViewCellAccessoryType editingAccessoryType; @property (nonatomic, getter=isSelected) BOOL selected; @property (nonatomic, getter=isHighlighted) BOOL highlighted; @property (nonatomic, getter=isEditing) BOOL editing; // not yet implemented @property (nonatomic, readonly) BOOL showingDeleteConfirmation; // not yet implemented @property (nonatomic, readonly, copy) NSString *reuseIdentifier; @property (nonatomic, assign) CGFloat indentationWidth; // 10 per default @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UITableViewCell.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UITableViewCell+UIPrivate.h" #import "UITableViewCellSeparator.h" #import "UIColor.h" #import "UILabel.h" #import "UIImageView.h" #import "UIFont.h" extern CGFloat _UITableViewDefaultRowHeight; @implementation UITableViewCell @synthesize accessoryType=_accessoryType, selectionStyle=_selectionStyle, indentationLevel=_indentationLevel; @synthesize editingAccessoryType=_editingAccessoryType, selected=_selected, backgroundView=_backgroundView; @synthesize selectedBackgroundView=_selectedBackgroundView, highlighted=_highlighted, reuseIdentifier=_reuseIdentifier; @synthesize editing = _editing, detailTextLabel = _detailTextLabel, showingDeleteConfirmation = _showingDeleteConfirmation; @synthesize indentationWidth=_indentationWidth, accessoryView=_accessoryView; - (id)initWithFrame:(CGRect)frame { if ((self=[super initWithFrame:frame])) { _indentationWidth = 10; _style = UITableViewCellStyleDefault; _selectionStyle = UITableViewCellSelectionStyleBlue; _seperatorView = [[UITableViewCellSeparator alloc] init]; [self addSubview:_seperatorView]; self.accessoryType = UITableViewCellAccessoryNone; self.editingAccessoryType = UITableViewCellAccessoryNone; } return self; } - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { if ((self=[self initWithFrame:CGRectMake(0,0,320,_UITableViewDefaultRowHeight)])) { _style = style; _reuseIdentifier = [reuseIdentifier copy]; } return self; } - (void)dealloc { [_seperatorView release]; [_contentView release]; [_accessoryView release]; [_textLabel release]; [_detailTextLabel release]; [_imageView release]; [_backgroundView release]; [_selectedBackgroundView release]; [_reuseIdentifier release]; [super dealloc]; } - (void)layoutSubviews { [super layoutSubviews]; const CGRect bounds = self.bounds; BOOL showingSeperator = !_seperatorView.hidden; CGRect contentFrame = CGRectMake(0,0,bounds.size.width,bounds.size.height-(showingSeperator? 1 : 0)); CGRect accessoryRect = CGRectMake(bounds.size.width,0,0,0); if(_accessoryView) { accessoryRect.size = [_accessoryView sizeThatFits: bounds.size]; accessoryRect.origin.x = bounds.size.width - accessoryRect.size.width; accessoryRect.origin.y = round(0.5*(bounds.size.height - accessoryRect.size.height)); _accessoryView.frame = accessoryRect; [self addSubview: _accessoryView]; contentFrame.size.width = accessoryRect.origin.x - 1; } _backgroundView.frame = contentFrame; _selectedBackgroundView.frame = contentFrame; _contentView.frame = contentFrame; [self sendSubviewToBack:_selectedBackgroundView]; [self sendSubviewToBack:_backgroundView]; [self bringSubviewToFront:_contentView]; [self bringSubviewToFront:_accessoryView]; if (showingSeperator) { _seperatorView.frame = CGRectMake(0,bounds.size.height-1,bounds.size.width,1); [self bringSubviewToFront:_seperatorView]; } if (_style == UITableViewCellStyleDefault) { const CGFloat padding = 5; const BOOL showImage = (_imageView.image != nil); const CGFloat imageWidth = (showImage? 30:0); _imageView.frame = CGRectMake(padding,0,imageWidth,contentFrame.size.height); CGRect textRect; textRect.origin = CGPointMake(padding+imageWidth+padding,0); textRect.size = CGSizeMake(MAX(0,contentFrame.size.width-textRect.origin.x-padding),contentFrame.size.height); _textLabel.frame = textRect; } } - (UIView *)contentView { if (!_contentView) { _contentView = [[UIView alloc] init]; [self addSubview:_contentView]; [self layoutIfNeeded]; } return _contentView; } - (UIImageView *)imageView { if (!_imageView) { _imageView = [[UIImageView alloc] init]; _imageView.contentMode = UIViewContentModeCenter; [self.contentView addSubview:_imageView]; [self layoutIfNeeded]; } return _imageView; } - (UILabel *)textLabel { if (!_textLabel) { _textLabel = [[UILabel alloc] init]; _textLabel.backgroundColor = [UIColor clearColor]; _textLabel.textColor = [UIColor blackColor]; _textLabel.highlightedTextColor = [UIColor whiteColor]; _textLabel.font = [UIFont boldSystemFontOfSize:17]; [self.contentView addSubview:_textLabel]; [self layoutIfNeeded]; } return _textLabel; } - (void)_setSeparatorStyle:(UITableViewCellSeparatorStyle)theStyle color:(UIColor *)theColor { [_seperatorView setSeparatorStyle:theStyle color:theColor]; } - (void)_setHighlighted:(BOOL)highlighted forViews:(id)subviews { for (id view in subviews) { if ([view respondsToSelector:@selector(setHighlighted:)]) { [view setHighlighted:highlighted]; } [self _setHighlighted:highlighted forViews:[view subviews]]; } } - (void)_updateSelectionState { BOOL shouldHighlight = (_highlighted || _selected); _selectedBackgroundView.hidden = !shouldHighlight; [self _setHighlighted:shouldHighlight forViews:[self subviews]]; } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { if (selected != _selected && _selectionStyle != UITableViewCellSelectionStyleNone) { _selected = selected; [self _updateSelectionState]; } } - (void)setSelected:(BOOL)selected { [self setSelected:selected animated:NO]; } - (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated { if (_highlighted != highlighted && _selectionStyle != UITableViewCellSelectionStyleNone) { _highlighted = highlighted; [self _updateSelectionState]; } } - (void)setHighlighted:(BOOL)highlighted { [self setHighlighted:highlighted animated:NO]; } - (void)setBackgroundView:(UIView *)theBackgroundView { if (theBackgroundView != _backgroundView) { [_backgroundView removeFromSuperview]; [_backgroundView release]; _backgroundView = [theBackgroundView retain]; [self addSubview:_backgroundView]; self.backgroundColor = [UIColor clearColor]; } } - (void)setSelectedBackgroundView:(UIView *)theSelectedBackgroundView { if (theSelectedBackgroundView != _selectedBackgroundView) { [_selectedBackgroundView removeFromSuperview]; [_selectedBackgroundView release]; _selectedBackgroundView = [theSelectedBackgroundView retain]; _selectedBackgroundView.hidden = !_selected; [self addSubview:_selectedBackgroundView]; } } - (void)prepareForReuse { } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UITableViewCellSeparator.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIView.h" #import "UITableViewCell.h" @class UIColor; @interface UITableViewCellSeparator : UIView { @private UITableViewCellSeparatorStyle _style; UIColor *_color; } - (void)setSeparatorStyle:(UITableViewCellSeparatorStyle)theStyle color:(UIColor *)theColor; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UITableViewCellSeparator.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UITableViewCellSeparator.h" #import "UIColor.h" #import "UIGraphics.h" @implementation UITableViewCellSeparator - (id)initWithFrame:(CGRect)frame { if ((self=[super initWithFrame:frame])) { _style = UITableViewCellSeparatorStyleNone; self.hidden = YES; } return self; } - (void)dealloc { [_color release]; [super dealloc]; } - (void)setSeparatorStyle:(UITableViewCellSeparatorStyle)theStyle color:(UIColor *)theColor { if (_style != theStyle) { _style = theStyle; [self setNeedsDisplay]; } if (_color != theColor) { [_color release]; _color = [theColor retain]; [self setNeedsDisplay]; } self.hidden = (_style == UITableViewCellSeparatorStyleNone); } - (void)drawRect:(CGRect)rect { if (_color) { if (_style == UITableViewCellSeparatorStyleSingleLine) { [_color setFill]; CGContextFillRect(UIGraphicsGetCurrentContext(),CGRectMake(0,0,self.bounds.size.width,1)); } } } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UITableViewController.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIViewController.h" #import "UITableView.h" @interface UITableViewController : UIViewController { @private UITableViewStyle _style; BOOL _clearsSelectionOnViewWillAppear; BOOL _hasReloaded; } - (id)initWithStyle:(UITableViewStyle)style; @property (nonatomic, strong) UITableView *tableView; @property (nonatomic) BOOL clearsSelectionOnViewWillAppear; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UITableViewController.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UITableViewController.h" @implementation UITableViewController @synthesize clearsSelectionOnViewWillAppear=_clearsSelectionOnViewWillAppear; - (id)init { return [self initWithStyle:UITableViewStylePlain]; } - (id)initWithStyle:(UITableViewStyle)theStyle { if ((self=[super initWithNibName:nil bundle:nil])) { _style = theStyle; } return self; } - (void)loadView { self.tableView = [[[UITableView alloc] initWithFrame:CGRectMake(0,0,320,480) style:_style] autorelease]; self.tableView.delegate = self; self.tableView.dataSource = self; } - (UITableView *)tableView { return (UITableView *)self.view; } - (void)setTableView:(UITableView *)theTableView { self.view = theTableView; } - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; if (!_hasReloaded) { [self.tableView reloadData]; _hasReloaded = YES; } if (_clearsSelectionOnViewWillAppear) { [self.tableView deselectRowAtIndexPath:self.tableView.indexPathForSelectedRow animated:animated]; } } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [self.tableView flashScrollIndicators]; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 0; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { return nil; } - (NSString *)description { return [NSString stringWithFormat:@"<%@: %p; tableView = %@>", [self className], self, self.tableView]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UITableViewSection.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @class UIView; @interface UITableViewSection : NSObject { CGFloat rowsHeight; CGFloat headerHeight; CGFloat footerHeight; NSInteger numberOfRows; CGFloat *rowHeights; UIView *headerView; UIView *footerView; NSString *headerTitle; NSString *footerTitle; } - (CGFloat)sectionHeight; - (void)setNumberOfRows:(NSInteger)rows withHeights:(CGFloat *)newRowHeights; @property (nonatomic, assign) CGFloat rowsHeight; @property (nonatomic, assign) CGFloat headerHeight; @property (nonatomic, assign) CGFloat footerHeight; @property (nonatomic, readonly) NSInteger numberOfRows; @property (nonatomic, readonly) CGFloat *rowHeights; @property (nonatomic, strong) UIView *headerView; @property (nonatomic, strong) UIView *footerView; @property (nonatomic, copy) NSString *headerTitle; @property (nonatomic, copy) NSString *footerTitle; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UITableViewSection.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UITableViewSection.h" #import "UIView.h" @implementation UITableViewSection @synthesize rowsHeight, headerHeight, footerHeight, rowHeights, numberOfRows, headerView, footerView, headerTitle, footerTitle; - (CGFloat)sectionHeight { return rowsHeight + headerHeight + footerHeight; } - (void)setNumberOfRows:(NSInteger)rows withHeights:(CGFloat *)newRowHeights { rowHeights = realloc(rowHeights, sizeof(CGFloat) * rows); memcpy(rowHeights, newRowHeights, sizeof(CGFloat) * rows); numberOfRows = rows; } - (void)dealloc { if (rowHeights) free(rowHeights); [headerView release]; [footerView release]; [headerTitle release]; [footerTitle release]; [super dealloc]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UITableViewSectionLabel.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UILabel.h" @interface UITableViewSectionLabel : UILabel + (UITableViewSectionLabel *)sectionLabelWithTitle:(NSString *)title; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UITableViewSectionLabel.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UITableViewSectionLabel.h" #import "UIGraphics.h" #import "AppKitIntegration.h" @implementation UITableViewSectionLabel + (UITableViewSectionLabel *)sectionLabelWithTitle:(NSString *)title { UITableViewSectionLabel *label = [[self alloc] init]; label.text = [NSString stringWithFormat:@" %@", title]; label.font = [UIFont boldSystemFontOfSize:17]; label.textColor = [UIColor whiteColor]; label.shadowColor = [UIColor colorWithRed:100/255.f green:105/255.f blue:110/255.f alpha:1]; label.shadowOffset = CGSizeMake(0,1); return [label autorelease]; } - (void)drawRect:(CGRect)rect { const CGSize size = self.bounds.size; [[UIColor colorWithRed:166/255.f green:177/255.f blue:187/255.f alpha:1] setFill]; UIRectFill(CGRectMake(0.f, 0.f, size.width, 1.f)); UIColor *startColor = [UIColor colorWithRed:145/255.f green:158/255.f blue:171/255.f alpha:1]; UIColor *endColor = [UIColor colorWithRed:185/255.f green:193/255.f blue:201/255.f alpha:1]; CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGFloat locations[2] = {0.f, 1.f}; const void *colors[2] = {startColor.CGColor, endColor.CGColor}; CFArrayRef gradientColors = CFArrayCreate(NULL, colors, 2, NULL); CGGradientRef gradient = CGGradientCreateWithColors(colorSpace, gradientColors, locations); CGColorSpaceRelease(colorSpace); CGContextDrawLinearGradient(UIGraphicsGetCurrentContext(), gradient, CGPointMake(0.f, 1.f), CGPointMake(0.f, size.height - 1.f), 0); CGGradientRelease(gradient); CFRelease(gradientColors); [[UIColor colorWithRed:153/255.f green:158/255.f blue:165/255.f alpha:1] setFill]; UIRectFill(CGRectMake(0.f, size.height - 1.f, size.width, 1.f)); [super drawRect:rect]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UITapGestureRecognizer.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIGestureRecognizer.h" @interface UITapGestureRecognizer : UIGestureRecognizer { NSUInteger _numberOfTapsRequired; NSUInteger _numberOfTouchesRequired; } @property (nonatomic) NSUInteger numberOfTapsRequired; @property (nonatomic) NSUInteger numberOfTouchesRequired; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UITapGestureRecognizer.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UITapGestureRecognizer.h" #import "UIGestureRecognizerSubclass.h" #import "UITouch.h" @implementation UITapGestureRecognizer @synthesize numberOfTapsRequired=_numberOfTapsRequired, numberOfTouchesRequired=_numberOfTouchesRequired; - (id)initWithTarget:(id)target action:(SEL)action { if ((self=[super initWithTarget:target action:action])) { _numberOfTapsRequired = 1; _numberOfTouchesRequired = 1; } return self; } - (BOOL)canBePreventedByGestureRecognizer:(UIGestureRecognizer *)preventingGestureRecognizer { // this logic is here based on a note in the docs for -canBePreventedByGestureRecognizer: // it may not be correct :) if ([preventingGestureRecognizer isKindOfClass:[UITapGestureRecognizer class]]) { return (((UITapGestureRecognizer *)preventingGestureRecognizer).numberOfTapsRequired > self.numberOfTapsRequired); } else { return [super canBePreventedByGestureRecognizer:preventingGestureRecognizer]; } } - (BOOL)canPreventGestureRecognizer:(UIGestureRecognizer *)preventedGestureRecognizer { // this logic is here based on a note in the docs for -canPreventGestureRecognizer: // it may not be correct :) if ([preventedGestureRecognizer isKindOfClass:[UITapGestureRecognizer class]]) { return (((UITapGestureRecognizer *)preventedGestureRecognizer).numberOfTapsRequired <= self.numberOfTapsRequired); } else { return [super canPreventGestureRecognizer:preventedGestureRecognizer]; } } - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; if (touch.tapCount >= self.numberOfTapsRequired) { if (self.state == UIGestureRecognizerStatePossible) { self.state = UIGestureRecognizerStateBegan; } else if (self.state == UIGestureRecognizerStateBegan) { self.state = UIGestureRecognizerStateChanged; } } } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { if (self.state == UIGestureRecognizerStateBegan || self.state == UIGestureRecognizerStateChanged) { self.state = UIGestureRecognizerStateCancelled; } } - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { if (self.state == UIGestureRecognizerStateBegan || self.state == UIGestureRecognizerStateChanged) { self.state = UIGestureRecognizerStateEnded; } } - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { if (self.state == UIGestureRecognizerStateBegan || self.state == UIGestureRecognizerStateChanged) { self.state = UIGestureRecognizerStateCancelled; } } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UITextField.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIControl.h" #import "UIStringDrawing.h" #import "UITextInputTraits.h" extern NSString *const UITextFieldTextDidBeginEditingNotification; extern NSString *const UITextFieldTextDidChangeNotification; extern NSString *const UITextFieldTextDidEndEditingNotification; typedef enum { UITextBorderStyleNone, UITextBorderStyleLine, UITextBorderStyleBezel, UITextBorderStyleRoundedRect } UITextBorderStyle; typedef enum { UITextFieldViewModeNever, UITextFieldViewModeWhileEditing, UITextFieldViewModeUnlessEditing, UITextFieldViewModeAlways } UITextFieldViewMode; @class UIFont, UIColor, UITextField, UIImage, UITextLayer; @protocol UITextFieldDelegate @optional - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField; - (void)textFieldDidBeginEditing:(UITextField *)textField; - (BOOL)textFieldShouldEndEditing:(UITextField *)textField; - (void)textFieldDidEndEditing:(UITextField *)textField; - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string; - (BOOL)textFieldShouldClear:(UITextField *)textField; - (BOOL)textFieldShouldReturn:(UITextField *)textField; @end @interface UITextField : UIControl { @private UITextLayer *_textLayer; __unsafe_unretained id _delegate; UITextFieldViewMode _clearButtonMode; UIView *_leftView; UITextFieldViewMode _leftViewMode; UIView *_rightView; UITextFieldViewMode _rightViewMode; UIImage *_background; UIImage *_disabledBackground; BOOL _editing; BOOL _clearsOnBeginEditing; BOOL _adjustsFontSizeToFitWidth; NSString *_placeholder; UITextBorderStyle _borderStyle; CGFloat _minimumFontSize; UIView *_inputAccessoryView; UIView *_inputView; struct { unsigned shouldBeginEditing : 1; unsigned didBeginEditing : 1; unsigned shouldEndEditing : 1; unsigned didEndEditing : 1; unsigned shouldChangeCharacters : 1; unsigned shouldClear : 1; unsigned shouldReturn : 1; } _delegateHas; } - (CGRect)borderRectForBounds:(CGRect)bounds; - (CGRect)clearButtonRectForBounds:(CGRect)bounds; - (CGRect)editingRectForBounds:(CGRect)bounds; - (CGRect)leftViewRectForBounds:(CGRect)bounds; - (CGRect)placeholderRectForBounds:(CGRect)bounds; - (CGRect)rightViewRectForBounds:(CGRect)bounds; - (CGRect)textRectForBounds:(CGRect)bounds; - (void)drawPlaceholderInRect:(CGRect)rect; - (void)drawTextInRect:(CGRect)rect; @property (nonatomic, assign) id delegate; @property (nonatomic, assign) UITextAlignment textAlignment; @property (nonatomic, copy) NSString *placeholder; @property (nonatomic, copy) NSString *text; @property (nonatomic, strong) UIFont *font; @property (nonatomic) UITextBorderStyle borderStyle; @property (nonatomic, strong) UIColor *textColor; @property (nonatomic, readonly, getter=isEditing) BOOL editing; @property (nonatomic) BOOL clearsOnBeginEditing; @property (nonatomic) BOOL adjustsFontSizeToFitWidth; @property (nonatomic) CGFloat minimumFontSize; @property (nonatomic, strong) UIImage *background; @property (nonatomic, strong) UIImage *disabledBackground; @property (nonatomic) UITextFieldViewMode clearButtonMode; @property (nonatomic, strong) UIView *leftView; @property (nonatomic) UITextFieldViewMode leftViewMode; @property (nonatomic, strong) UIView *rightView; @property (nonatomic) UITextFieldViewMode rightViewMode; @property (nonatomic, readwrite, strong) UIView *inputAccessoryView; @property (nonatomic, readwrite, strong) UIView *inputView; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UITextField.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UITextField.h" #import "UITextLayer.h" #import "UIColor.h" #import "UIFont.h" #import "UIImage.h" #import NSString *const UITextFieldTextDidBeginEditingNotification = @"UITextFieldTextDidBeginEditingNotification"; NSString *const UITextFieldTextDidChangeNotification = @"UITextFieldTextDidChangeNotification"; NSString *const UITextFieldTextDidEndEditingNotification = @"UITextFieldTextDidEndEditingNotification"; @interface UIControl () @end @interface UITextField () @end @implementation UITextField @synthesize delegate=_delegate, background=_background, disabledBackground=_disabledBackground, editing=_editing, clearsOnBeginEditing=_clearsOnBeginEditing; @synthesize adjustsFontSizeToFitWidth=_adjustsFontSizeToFitWidth, clearButtonMode=_clearButtonMode, leftView=_leftView, rightView=_rightView; @synthesize leftViewMode=_leftViewMode, rightViewMode=_rightViewMode, placeholder=_placeholder, borderStyle=_borderStyle; @synthesize inputAccessoryView=_inputAccessoryView, inputView=_inputView, minimumFontSize=_minimumFontSize; - (id)initWithFrame:(CGRect)frame { if ((self=[super initWithFrame:frame])) { _textLayer = [[UITextLayer alloc] initWithContainer:self isField:YES]; [self.layer insertSublayer:_textLayer atIndex:0]; self.textAlignment = UITextAlignmentLeft; self.font = [UIFont systemFontOfSize:17]; self.borderStyle = UITextBorderStyleNone; self.textColor = [UIColor blackColor]; self.clearButtonMode = UITextFieldViewModeNever; self.leftViewMode = UITextFieldViewModeNever; self.rightViewMode = UITextFieldViewModeNever; self.opaque = NO; } return self; } - (void)dealloc { [_textLayer removeFromSuperlayer]; [_textLayer release]; [_leftView release]; [_rightView release]; [_background release]; [_disabledBackground release]; [_placeholder release]; [_inputAccessoryView release]; [_inputView release]; [super dealloc]; } - (BOOL)_isLeftViewVisible { return _leftView && (_leftViewMode == UITextFieldViewModeAlways || (_editing && _leftViewMode == UITextFieldViewModeWhileEditing) || (!_editing && _leftViewMode == UITextFieldViewModeUnlessEditing)); } - (BOOL)_isRightViewVisible { return _rightView && (_rightViewMode == UITextFieldViewModeAlways || (_editing && _rightViewMode == UITextFieldViewModeWhileEditing) || (!_editing && _rightViewMode == UITextFieldViewModeUnlessEditing)); } - (void)layoutSubviews { [super layoutSubviews]; const CGRect bounds = self.bounds; _textLayer.frame = [self textRectForBounds:bounds]; if ([self _isLeftViewVisible]) { _leftView.hidden = NO; _leftView.frame = [self leftViewRectForBounds:bounds]; } else { _leftView.hidden = YES; } if ([self _isRightViewVisible]) { _rightView.hidden = NO; _rightView.frame = [self rightViewRectForBounds:bounds]; } else { _rightView.hidden = YES; } } - (void)setDelegate:(id)theDelegate { if (theDelegate != _delegate) { _delegate = theDelegate; _delegateHas.shouldBeginEditing = [_delegate respondsToSelector:@selector(textFieldShouldBeginEditing:)]; _delegateHas.didBeginEditing = [_delegate respondsToSelector:@selector(textFieldDidBeginEditing:)]; _delegateHas.shouldEndEditing = [_delegate respondsToSelector:@selector(textFieldShouldEndEditing:)]; _delegateHas.didEndEditing = [_delegate respondsToSelector:@selector(textFieldDidEndEditing:)]; _delegateHas.shouldChangeCharacters = [_delegate respondsToSelector:@selector(textField:shouldChangeCharactersInRange:replacementString:)]; _delegateHas.shouldClear = [_delegate respondsToSelector:@selector(textFieldShouldClear:)]; _delegateHas.shouldReturn = [_delegate respondsToSelector:@selector(textFieldShouldReturn:)]; } } - (void)setPlaceholder:(NSString *)thePlaceholder { if (![thePlaceholder isEqualToString:_placeholder]) { [_placeholder release]; _placeholder = [thePlaceholder copy]; [self setNeedsDisplay]; } } - (void)setBorderStyle:(UITextBorderStyle)style { if (style != _borderStyle) { _borderStyle = style; [self setNeedsDisplay]; } } - (void)setBackground:(UIImage *)aBackground { if (aBackground != _background) { [_background release]; _background = [aBackground retain]; [self setNeedsDisplay]; } } - (void)setDisabledBackground:(UIImage *)aBackground { if (aBackground != _disabledBackground) { [_disabledBackground release]; _disabledBackground = [aBackground retain]; [self setNeedsDisplay]; } } - (void)setLeftView:(UIView *)leftView { if (leftView != _leftView) { [_leftView removeFromSuperview]; [_leftView release]; _leftView = [leftView retain]; [self addSubview:_leftView]; } } - (void)setRightView:(UIView *)rightView { if (rightView != _rightView) { [_rightView removeFromSuperview]; [_rightView release]; _rightView = [rightView retain]; [self addSubview:_rightView]; } } - (void)setFrame:(CGRect)frame { if (!CGRectEqualToRect(frame,self.frame)) { [super setFrame:frame]; [self setNeedsDisplay]; } } - (CGRect)borderRectForBounds:(CGRect)bounds { return bounds; } - (CGRect)clearButtonRectForBounds:(CGRect)bounds { return CGRectZero; } - (CGRect)editingRectForBounds:(CGRect)bounds { return [self textRectForBounds:bounds]; } - (CGRect)leftViewRectForBounds:(CGRect)bounds { if (_leftView) { const CGRect frame = _leftView.frame; bounds.origin.x = 0; bounds.origin.y = (bounds.size.height / 2.f) - (frame.size.height/2.f); bounds.size = frame.size; return CGRectIntegral(bounds); } else { return CGRectZero; } } - (CGRect)placeholderRectForBounds:(CGRect)bounds { return [self textRectForBounds:bounds]; } - (CGRect)rightViewRectForBounds:(CGRect)bounds { if (_rightView) { const CGRect frame = _rightView.frame; bounds.origin.x = bounds.size.width - frame.size.width; bounds.origin.y = (bounds.size.height / 2.f) - (frame.size.height/2.f); bounds.size = frame.size; return CGRectIntegral(bounds); } else { return CGRectZero; } } - (CGRect)textRectForBounds:(CGRect)bounds { // Docs say: // The default implementation of this method returns a rectangle that is derived from the control’s original bounds, // but which does not include the area occupied by the receiver’s border or overlay views. // It appears what happens is something like this: // check border type: // if no border, skip to next major step // if has border, set textRect = borderBounds, then inset textRect according to border style // check if textRect overlaps with leftViewRect, if it does, make it smaller // check if textRect overlaps with rightViewRect, if it does, make it smaller // check if textRect overlaps with clearButtonRect (if currently needed?), if it does, make it smaller CGRect textRect = bounds; if (_borderStyle != UITextBorderStyleNone) { textRect = [self borderRectForBounds:bounds]; // TODO: inset the bounds based on border types... } // Going to go ahead and assume that the left view is on the left, the right view is on the right, and there's space between.. // I imagine this is a dangerous assumption... if ([self _isLeftViewVisible]) { CGRect overlap = CGRectIntersection(textRect,[self leftViewRectForBounds:bounds]); if (!CGRectIsNull(overlap)) { textRect = CGRectOffset(textRect, overlap.size.width, 0); textRect.size.width -= overlap.size.width; } } if ([self _isRightViewVisible]) { CGRect overlap = CGRectIntersection(textRect,[self rightViewRectForBounds:bounds]); if (!CGRectIsNull(overlap)) { textRect = CGRectOffset(textRect, -overlap.size.width, 0); textRect.size.width -= overlap.size.width; } } return CGRectIntegral(bounds); } - (void)drawPlaceholderInRect:(CGRect)rect { } - (void)drawTextInRect:(CGRect)rect { } - (void)drawRect:(CGRect)rect { UIImage *background = self.enabled? _background : _disabledBackground; [background drawInRect:self.bounds]; } - (UITextAutocapitalizationType)autocapitalizationType { return UITextAutocapitalizationTypeNone; } - (void)setAutocapitalizationType:(UITextAutocapitalizationType)type { } - (UITextAutocorrectionType)autocorrectionType { return UITextAutocorrectionTypeDefault; } - (void)setAutocorrectionType:(UITextAutocorrectionType)type { } - (BOOL)enablesReturnKeyAutomatically { return YES; } - (void)setEnablesReturnKeyAutomatically:(BOOL)enabled { } - (UIKeyboardAppearance)keyboardAppearance { return UIKeyboardAppearanceDefault; } - (void)setKeyboardAppearance:(UIKeyboardAppearance)type { } - (UIKeyboardType)keyboardType { return UIKeyboardTypeDefault; } - (void)setKeyboardType:(UIKeyboardType)type { } - (UIReturnKeyType)returnKeyType { return UIReturnKeyDefault; } - (void)setReturnKeyType:(UIReturnKeyType)type { } - (BOOL)isSecureTextEntry { return [_textLayer isSecureTextEntry]; } - (void)setSecureTextEntry:(BOOL)secure { [_textLayer setSecureTextEntry:secure]; } - (BOOL)canBecomeFirstResponder { return (self.window != nil); } - (BOOL)becomeFirstResponder { if ([super becomeFirstResponder]) { return [_textLayer becomeFirstResponder]; } else { return NO; } } - (BOOL)resignFirstResponder { if ([super resignFirstResponder]) { return [_textLayer resignFirstResponder]; } else { return NO; } } - (UIFont *)font { return _textLayer.font; } - (void)setFont:(UIFont *)newFont { _textLayer.font = newFont; } - (UIColor *)textColor { return _textLayer.textColor; } - (void)setTextColor:(UIColor *)newColor { _textLayer.textColor = newColor; } - (UITextAlignment)textAlignment { return _textLayer.textAlignment; } - (void)setTextAlignment:(UITextAlignment)textAlignment { _textLayer.textAlignment = textAlignment; } - (NSString *)text { return _textLayer.text; } - (void)setText:(NSString *)newText { _textLayer.text = newText; } - (BOOL)_textShouldBeginEditing { return _delegateHas.shouldBeginEditing? [_delegate textFieldShouldBeginEditing:self] : YES; } - (void)_textDidBeginEditing { BOOL shouldClear = _clearsOnBeginEditing; if (shouldClear && _delegateHas.shouldClear) { shouldClear = [_delegate textFieldShouldClear:self]; } if (shouldClear) { // this doesn't work - it can cause an exception to trigger. hrm... // so... rather than worry too much about it right now, just gonna delay it :P //self.text = @""; [self performSelector:@selector(setText:) withObject:@"" afterDelay:0]; } _editing = YES; [self setNeedsDisplay]; [self setNeedsLayout]; if (_delegateHas.didBeginEditing) { [_delegate textFieldDidBeginEditing:self]; } [[NSNotificationCenter defaultCenter] postNotificationName:UITextFieldTextDidBeginEditingNotification object:self]; } - (BOOL)_textShouldEndEditing { return _delegateHas.shouldEndEditing? [_delegate textFieldShouldEndEditing:self] : YES; } - (void)_textDidEndEditing { _editing = NO; [self setNeedsDisplay]; [self setNeedsLayout]; if (_delegateHas.didEndEditing) { [_delegate textFieldDidEndEditing:self]; } [[NSNotificationCenter defaultCenter] postNotificationName:UITextFieldTextDidEndEditingNotification object:self]; } - (BOOL)_textShouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text { return _delegateHas.shouldChangeCharacters? [_delegate textField:self shouldChangeCharactersInRange:range replacementString:text] : YES; } - (void)_textDidChange { [[NSNotificationCenter defaultCenter] postNotificationName:UITextFieldTextDidChangeNotification object:self]; } - (void)_textDidReceiveReturnKey { if (_delegateHas.shouldReturn) { [_delegate textFieldShouldReturn:self]; } } - (NSString *)description { NSString *textAlignment = @""; switch (self.textAlignment) { case UITextAlignmentLeft: textAlignment = @"Left"; break; case UITextAlignmentCenter: textAlignment = @"Center"; break; case UITextAlignmentRight: textAlignment = @"Right"; break; } return [NSString stringWithFormat:@"<%@: %p; textAlignment = %@; editing = %@; textColor = %@; font = %@; delegate = %@>", [self className], self, textAlignment, (self.editing ? @"YES" : @"NO"), self.textColor, self.font, self.delegate]; } - (id)mouseCursorForEvent:(UIEvent *)event { return [NSCursor IBeamCursor]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UITextInputTraits.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import typedef enum { UITextAutocapitalizationTypeNone, UITextAutocapitalizationTypeWords, UITextAutocapitalizationTypeSentences, UITextAutocapitalizationTypeAllCharacters, } UITextAutocapitalizationType; typedef enum { UITextAutocorrectionTypeDefault, UITextAutocorrectionTypeNo, UITextAutocorrectionTypeYes, } UITextAutocorrectionType; typedef enum { UIKeyboardAppearanceDefault, UIKeyboardAppearanceAlert, } UIKeyboardAppearance; typedef enum { UIKeyboardTypeDefault, UIKeyboardTypeASCIICapable, UIKeyboardTypeNumbersAndPunctuation, UIKeyboardTypeURL, UIKeyboardTypeNumberPad, UIKeyboardTypePhonePad, UIKeyboardTypeNamePhonePad, UIKeyboardTypeEmailAddress, UIKeyboardTypeAlphabet = UIKeyboardTypeASCIICapable } UIKeyboardType; typedef enum { UIReturnKeyDefault, UIReturnKeyGo, UIReturnKeyGoogle, UIReturnKeyJoin, UIReturnKeyNext, UIReturnKeyRoute, UIReturnKeySearch, UIReturnKeySend, UIReturnKeyYahoo, UIReturnKeyDone, UIReturnKeyEmergencyCall, } UIReturnKeyType; @protocol UITextInputTraits @property (nonatomic) UITextAutocapitalizationType autocapitalizationType; @property (nonatomic) UITextAutocorrectionType autocorrectionType; @property (nonatomic) BOOL enablesReturnKeyAutomatically; @property (nonatomic) UIKeyboardAppearance keyboardAppearance; @property (nonatomic) UIKeyboardType keyboardType; @property (nonatomic) UIReturnKeyType returnKeyType; @property (nonatomic, getter=isSecureTextEntry) BOOL secureTextEntry; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UITextLayer.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import #import #import "UIStringDrawing.h" @class UICustomNSClipView, UICustomNSTextView, UIColor, UIFont, UIScrollView, UIWindow, UIView; @protocol UITextLayerContainerViewProtocol @required - (UIWindow *)window; - (CALayer *)layer; - (BOOL)isHidden; - (BOOL)isDescendantOfView:(UIView *)view; - (BOOL)becomeFirstResponder; - (BOOL)resignFirstResponder; // if any one of these doesn't exist, then scrolling of the NSClipView is disabled @optional - (BOOL)isScrollEnabled; - (void)setContentOffset:(CGPoint)offset; - (CGPoint)contentOffset; - (void)setContentSize:(CGSize)size; - (CGSize)contentSize; @end @protocol UITextLayerTextDelegate @required - (BOOL)_textShouldBeginEditing; - (void)_textDidBeginEditing; - (BOOL)_textShouldEndEditing; - (void)_textDidEndEditing; - (BOOL)_textShouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text; @optional - (void)_textDidChange; - (void)_textDidChangeSelection; - (void)_textDidReceiveReturnKey; @end @interface UITextLayer : CALayer { id containerView; BOOL containerCanScroll; UICustomNSTextView *textView; UICustomNSClipView *clipView; BOOL secureTextEntry; BOOL editable; UIColor *textColor; UIFont *font; BOOL changingResponderStatus; struct { unsigned didChange : 1; unsigned didChangeSelection : 1; unsigned didReturnKey : 1; } textDelegateHas; } - (id)initWithContainer:(UIView *)aView isField:(BOOL)isField; - (void)setContentOffset:(CGPoint)contentOffset; - (void)scrollRangeToVisible:(NSRange)range; - (BOOL)becomeFirstResponder; - (BOOL)resignFirstResponder; @property (nonatomic, assign) NSRange selectedRange; @property (nonatomic, copy) NSString *text; @property (nonatomic, strong) UIColor *textColor; @property (nonatomic, strong) UIFont *font; @property (nonatomic, assign) BOOL editable; @property (nonatomic, getter=isSecureTextEntry) BOOL secureTextEntry; @property (nonatomic, assign) UITextAlignment textAlignment; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UITextLayer.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UITextLayer.h" #import "UIScrollView.h" #import "UICustomNSTextView.h" #import "UICustomNSClipView.h" #import "UIWindow.h" #import "UIScreen+UIPrivate.h" #import "UIScreenAppKitIntegration.h" #import "UIApplication+UIPrivate.h" #import "AppKitIntegration.h" #import "UIView+UIPrivate.h" #import "UIKitView.h" #import #import @interface UITextLayer () - (void)removeNSView; @end @implementation UITextLayer @synthesize textColor, font, editable, secureTextEntry; - (id)initWithContainer:(UIView *)aView isField:(BOOL)isField { if ((self=[super init])) { self.masksToBounds = NO; containerView = aView; textDelegateHas.didChange = [containerView respondsToSelector:@selector(_textDidChange)]; textDelegateHas.didChangeSelection = [containerView respondsToSelector:@selector(_textDidChangeSelection)]; textDelegateHas.didReturnKey = [containerView respondsToSelector:@selector(_textDidReceiveReturnKey)]; containerCanScroll = [containerView respondsToSelector:@selector(setContentOffset:)] && [containerView respondsToSelector:@selector(contentOffset)] && [containerView respondsToSelector:@selector(setContentSize:)] && [containerView respondsToSelector:@selector(contentSize)] && [containerView respondsToSelector:@selector(isScrollEnabled)]; clipView = [(UICustomNSClipView *)[UICustomNSClipView alloc] initWithFrame:NSMakeRect(0,0,100,100)]; textView = [(UICustomNSTextView *)[UICustomNSTextView alloc] initWithFrame:[clipView frame] secureTextEntry:secureTextEntry isField:isField]; [textView setDelegate:self]; [clipView setDocumentView:textView]; self.textAlignment = UITextAlignmentLeft; [self setNeedsLayout]; } return self; } - (void)dealloc { [textView setDelegate:nil]; [self removeNSView]; [clipView release]; [textView release]; [textColor release]; [font release]; [super dealloc]; } // Need to prevent Core Animation effects from happening... very ugly otherwise. - (id < CAAction >)actionForKey:(NSString *)aKey { return nil; } - (void)addNSView { if (containerCanScroll) { [clipView scrollToPoint:NSPointFromCGPoint([containerView contentOffset])]; } else { [clipView scrollToPoint:NSZeroPoint]; } clipView.parentLayer = self; clipView.behaviorDelegate = self; [[[[containerView window] screen] UIKitView] addSubview:clipView]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateScrollViewContentOffset) name:NSViewBoundsDidChangeNotification object:clipView]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(hierarchyDidChangeNotification:) name:UIViewFrameDidChangeNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(hierarchyDidChangeNotification:) name:UIViewBoundsDidChangeNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(hierarchyDidChangeNotification:) name:UIViewDidMoveToSuperviewNotification object:nil]; } - (void)removeNSView { [[NSNotificationCenter defaultCenter] removeObserver:self name:NSViewBoundsDidChangeNotification object:clipView]; [[NSNotificationCenter defaultCenter] removeObserver:self name:UIViewFrameDidChangeNotification object:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self name:UIViewBoundsDidChangeNotification object:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self name:UIViewDidMoveToSuperviewNotification object:nil]; clipView.parentLayer = nil; clipView.behaviorDelegate = nil; [clipView removeFromSuperview]; } - (void)updateScrollViewContentSize { if (containerCanScroll) { // also update the content size in the UIScrollView const NSRect docRect = [clipView documentRect]; [containerView setContentSize:CGSizeMake(docRect.size.width+docRect.origin.x, docRect.size.height+docRect.origin.y)]; } } - (BOOL)shouldBeVisible { return ([containerView window] && (self.superlayer == [containerView layer]) && !self.hidden && ![containerView isHidden]); } - (void)updateNSViews { if ([self shouldBeVisible]) { if (![clipView superview]) { [self addNSView]; } UIWindow *window = [containerView window]; const CGRect windowRect = [window convertRect:self.frame fromView:containerView]; const CGRect screenRect = [window convertRect:windowRect toWindow:nil]; NSRect desiredFrame = NSRectFromCGRect(screenRect); [clipView setFrame:desiredFrame]; [self updateScrollViewContentSize]; clipView.layer.geometryFlipped = YES; } else { [self removeNSView]; } } - (void)layoutSublayers { [self updateNSViews]; [super layoutSublayers]; } - (void)removeFromSuperlayer { [super removeFromSuperlayer]; [self updateNSViews]; } - (void)setHidden:(BOOL)hide { if (hide != self.hidden) { [super setHidden:hide]; [self updateNSViews]; } } - (void)hierarchyDidChangeNotification:(NSNotification *)note { if ([containerView isDescendantOfView:[note object]]) { if ([self shouldBeVisible]) { [self setNeedsLayout]; } else { [self removeNSView]; } } } - (void)setContentOffset:(CGPoint)contentOffset { NSPoint point = [clipView constrainScrollPoint:NSPointFromCGPoint(contentOffset)]; [clipView scrollToPoint:point]; } - (void)updateScrollViewContentOffset { if (containerCanScroll) { [containerView setContentOffset:NSPointToCGPoint([clipView bounds].origin)]; } } - (void)setFont:(UIFont *)newFont { assert(newFont != nil); if (newFont != font) { [font release]; font = [newFont retain]; [textView setFont:[font NSFont]]; } } - (void)setTextColor:(UIColor *)newColor { if (newColor != textColor) { [textColor release]; textColor = [newColor retain]; [textView setTextColor:[textColor NSColor]]; } } - (NSString *)text { return [textView string]; } - (void)setText:(NSString *)newText { [textView setString:newText ?: @""]; [self updateScrollViewContentSize]; } - (void)setSecureTextEntry:(BOOL)s { if (s != secureTextEntry) { secureTextEntry = s; [textView setSecureTextEntry:secureTextEntry]; } } - (void)setEditable:(BOOL)edit { if (editable != edit) { editable = edit; [textView setEditable:editable]; } } - (void)scrollRangeToVisible:(NSRange)range { [textView scrollRangeToVisible:range]; } - (NSRange)selectedRange { return [textView selectedRange]; } - (void)setSelectedRange:(NSRange)range { [textView setSelectedRange:range]; } - (void)setTextAlignment:(UITextAlignment)textAlignment { switch (textAlignment) { case UITextAlignmentLeft: [textView setAlignment:NSLeftTextAlignment]; break; case UITextAlignmentCenter: [textView setAlignment:NSCenterTextAlignment]; break; case UITextAlignmentRight: [textView setAlignment:NSRightTextAlignment]; break; } } - (UITextAlignment)textAlignment { switch ([textView alignment]) { case NSCenterTextAlignment: return UITextAlignmentCenter; case NSRightTextAlignment: return UITextAlignmentRight; default: return UITextAlignmentLeft; } } // this is used to fake out AppKit when the UIView that owns this layer/editor stuff is actually *behind* another UIView. Since the NSViews are // technically above all of the UIViews, they'd normally capture all clicks no matter what might happen to be obscuring them. That would obviously // be less than ideal. This makes it ideal. Awesome. - (BOOL)hitTestForClipViewPoint:(NSPoint)point { UIScreen *screen = [[containerView window] screen]; if (screen) { if (![[screen UIKitView] isFlipped]) { point.y = screen.bounds.size.height - point.y - 1; } return (containerView == [[[containerView window] screen] _hitTest:NSPointToCGPoint(point) event:nil]); } return NO; } - (BOOL)clipViewShouldScroll { return containerCanScroll && [containerView isScrollEnabled]; } - (BOOL)textShouldBeginEditing:(NSText *)aTextObject { return [containerView _textShouldBeginEditing]; } - (void)textDidBeginEditing:(NSNotification *)aNotification { [containerView _textDidBeginEditing]; } - (BOOL)textShouldEndEditing:(NSText *)aTextObject { return [containerView _textShouldEndEditing]; } - (void)textDidEndEditing:(NSNotification *)aNotification { [containerView _textDidEndEditing]; } - (void)textDidChange:(NSNotification *)aNotification { if (textDelegateHas.didChangeSelection) { // IMPORTANT! see notes about why this hack exists down in -textViewDidChangeSelection:! [NSObject cancelPreviousPerformRequestsWithTarget:containerView selector:@selector(_textDidChangeSelection) object:nil]; } if (textDelegateHas.didChange) { [containerView _textDidChange]; } } - (void)textViewDidChangeSelection:(NSNotification *)aNotification { if (textDelegateHas.didChangeSelection) { // this defers the sending of the selection change delegate message. the reason is that on the real iOS, Apple does not appear to send // the selection changing delegate messages when text is actually changing. since I can't find a decent way to check here if text is // actually changing or if the cursor is just moving, I'm deferring the actual sending of this message. above in -textDidChange:, it // cancels the deferred send if it ends up that text actually changed. this only works if -textDidChange: is sent after // -textViewDidChangeSelection: which appears to be the case, but I don't think this is documented anywhere so this could possibly // break someday. anyway, the end result of this nasty hack is that UITextLayer shouldn't send out the selection changing notifications // while text is being changed, which mirrors how the real UIKit appears to work in this regard. note that the real UIKit also appears // to NOT send the selection change notification if you had multiple characters selected and then typed a single character thus // replacing the selected text with the single new character. happily this hack appears to function the same way. [containerView performSelector:@selector(_textDidChangeSelection) withObject:nil afterDelay:0]; } } - (BOOL)textView:(NSTextView *)aTextView shouldChangeTextInRange:(NSRange)affectedCharRange replacementString:(NSString *)replacementString { // always prevent newlines when in field editing mode. this seems like a heavy-handed way of doing it, but it's also easy and quick. // it should really probably be in the UICustomNSTextView class somewhere and not here, but this works okay, too, I guess. // this is also being done in doCommandBySelector: below, but it's done here as well to prevent pasting stuff in with newlines in it. // seems like a hack, I dunno. if ([textView isFieldEditor] && ([replacementString rangeOfCharacterFromSet:[NSCharacterSet newlineCharacterSet]].location != NSNotFound)) { return NO; } else { return [containerView _textShouldChangeTextInRange:affectedCharRange replacementText:replacementString]; } } - (BOOL)textView:(NSTextView *)aTextView doCommandBySelector:(SEL)aSelector { // this makes sure there's no newlines added when in field editing mode. // it also allows us to handle when return/enter is pressed differently for fields. Dunno if there's a better way or not. if ([textView isFieldEditor] && ((aSelector == @selector(insertNewline:) || (aSelector == @selector(insertNewlineIgnoringFieldEditor:))))) { if (textDelegateHas.didReturnKey) { [containerView _textDidReceiveReturnKey]; } return YES; } return NO; } - (BOOL)textViewBecomeFirstResponder:(UICustomNSTextView *)aTextView { if (changingResponderStatus) { return [aTextView reallyBecomeFirstResponder]; } else { return [containerView becomeFirstResponder]; } } - (BOOL)textViewResignFirstResponder:(UICustomNSTextView *)aTextView { if (changingResponderStatus) { return [aTextView reallyResignFirstResponder]; } else { return [containerView resignFirstResponder]; } } - (BOOL)becomeFirstResponder { if ([self shouldBeVisible] && ![clipView superview]) { [self addNSView]; } changingResponderStatus = YES; const BOOL result = [[textView window] makeFirstResponder:textView]; changingResponderStatus = NO; return result; } - (BOOL)resignFirstResponder { changingResponderStatus = YES; const BOOL result = [[textView window] makeFirstResponder:[[[containerView window] screen] UIKitView]]; changingResponderStatus = NO; return result; } - (BOOL)textView:(UICustomNSTextView *)aTextView shouldAcceptKeyDown:(NSEvent *)event { return ![[UIApplication sharedApplication] _sendGlobalKeyboardNSEvent:event fromScreen:[[containerView window] screen]]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UITextView.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIStringDrawing.h" #import "UIScrollView.h" #import "UIDataDetectors.h" #import "UITextInputTraits.h" extern NSString *const UITextViewTextDidBeginEditingNotification; extern NSString *const UITextViewTextDidChangeNotification; extern NSString *const UITextViewTextDidEndEditingNotification; @class UIColor, UIFont, UITextLayer, UITextView; @protocol UITextViewDelegate @optional - (BOOL)textViewShouldBeginEditing:(UITextView *)textView; - (void)textViewDidBeginEditing:(UITextView *)textView; - (BOOL)textViewShouldEndEditing:(UITextView *)textView; - (void)textViewDidEndEditing:(UITextView *)textView; - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text; - (void)textViewDidChange:(UITextView *)textView; - (void)textViewDidChangeSelection:(UITextView *)textView; @end @interface UITextView : UIScrollView { @private UITextLayer *_textLayer; UIDataDetectorTypes _dataDetectorTypes; UIView *_inputAccessoryView; UIView *_inputView; struct { unsigned shouldBeginEditing : 1; unsigned didBeginEditing : 1; unsigned shouldEndEditing : 1; unsigned didEndEditing : 1; unsigned shouldChangeText : 1; unsigned didChange : 1; unsigned didChangeSelection : 1; } _delegateHas; } - (void)scrollRangeToVisible:(NSRange)range; @property (nonatomic) UITextAlignment textAlignment; // stub, not yet implemented! @property (nonatomic) NSRange selectedRange; @property (nonatomic, getter=isEditable) BOOL editable; @property (nonatomic, copy) NSString *text; @property (nonatomic, strong) UIColor *textColor; @property (nonatomic, strong) UIFont *font; @property (nonatomic) UIDataDetectorTypes dataDetectorTypes; @property (nonatomic, assign) id delegate; @property (nonatomic, readwrite, strong) UIView *inputAccessoryView; @property (nonatomic, readwrite, strong) UIView *inputView; - (BOOL)hasText; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UITextView.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UITextView.h" #import "UIColor.h" #import "UIFont.h" #import "UITextLayer.h" #import "UIScrollView.h" #import NSString *const UITextViewTextDidBeginEditingNotification = @"UITextViewTextDidBeginEditingNotification"; NSString *const UITextViewTextDidChangeNotification = @"UITextViewTextDidChangeNotification"; NSString *const UITextViewTextDidEndEditingNotification = @"UITextViewTextDidEndEditingNotification"; @interface UIScrollView () @end @interface UITextView () @end @implementation UITextView @synthesize dataDetectorTypes=_dataDetectorTypes, inputAccessoryView=_inputAccessoryView, inputView=_inputView; @dynamic delegate; - (id)initWithFrame:(CGRect)frame { if ((self=[super initWithFrame:frame])) { _textLayer = [[UITextLayer alloc] initWithContainer:self isField:NO]; [self.layer insertSublayer:_textLayer atIndex:0]; self.textColor = [UIColor blackColor]; self.font = [UIFont systemFontOfSize:17]; self.dataDetectorTypes = UIDataDetectorTypeAll; self.editable = YES; self.contentMode = UIViewContentModeScaleToFill; self.clipsToBounds = YES; } return self; } - (void)dealloc { [_textLayer removeFromSuperlayer]; [_textLayer release]; [_inputAccessoryView release]; [_inputView release]; [super dealloc]; } - (void)layoutSubviews { [super layoutSubviews]; _textLayer.frame = self.bounds; } - (void)setContentOffset:(CGPoint)theOffset animated:(BOOL)animated { [super setContentOffset:theOffset animated:animated]; [_textLayer setContentOffset:theOffset]; } - (void)scrollRangeToVisible:(NSRange)range { [_textLayer scrollRangeToVisible:range]; } - (UITextAutocapitalizationType)autocapitalizationType { return UITextAutocapitalizationTypeNone; } - (void)setAutocapitalizationType:(UITextAutocapitalizationType)type { } - (UITextAutocorrectionType)autocorrectionType { return UITextAutocorrectionTypeDefault; } - (void)setAutocorrectionType:(UITextAutocorrectionType)type { } - (BOOL)enablesReturnKeyAutomatically { return YES; } - (void)setEnablesReturnKeyAutomatically:(BOOL)enabled { } - (UIKeyboardAppearance)keyboardAppearance { return UIKeyboardAppearanceDefault; } - (void)setKeyboardAppearance:(UIKeyboardAppearance)type { } - (UIKeyboardType)keyboardType { return UIKeyboardTypeDefault; } - (void)setKeyboardType:(UIKeyboardType)type { } - (UIReturnKeyType)returnKeyType { return UIReturnKeyDefault; } - (void)setReturnKeyType:(UIReturnKeyType)type { } - (BOOL)isSecureTextEntry { return [_textLayer isSecureTextEntry]; } - (void)setSecureTextEntry:(BOOL)secure { [_textLayer setSecureTextEntry:secure]; } - (BOOL)canBecomeFirstResponder { return (self.window != nil); } - (BOOL)becomeFirstResponder { if ([super becomeFirstResponder] ){ return [_textLayer becomeFirstResponder]; } else { return NO; } } - (BOOL)resignFirstResponder { if ([super resignFirstResponder]) { return [_textLayer resignFirstResponder]; } else { return NO; } } - (UIFont *)font { return _textLayer.font; } - (void)setFont:(UIFont *)newFont { _textLayer.font = newFont; } - (UIColor *)textColor { return _textLayer.textColor; } - (void)setTextColor:(UIColor *)newColor { _textLayer.textColor = newColor; } - (UITextAlignment)textAlignment { return _textLayer.textAlignment; } - (void)setTextAlignment:(UITextAlignment)textAlignment { _textLayer.textAlignment = textAlignment; } - (NSString *)text { return _textLayer.text; } - (void)setText:(NSString *)newText { _textLayer.text = newText; } - (BOOL)isEditable { return _textLayer.editable; } - (void)setEditable:(BOOL)editable { _textLayer.editable = editable; } - (NSRange)selectedRange { return _textLayer.selectedRange; } - (void)setSelectedRange:(NSRange)range { _textLayer.selectedRange = range; } - (BOOL)hasText { return [_textLayer.text length] > 0; } - (void)setDelegate:(id)theDelegate { if (theDelegate != self.delegate) { [super setDelegate:theDelegate]; _delegateHas.shouldBeginEditing = [theDelegate respondsToSelector:@selector(textViewShouldBeginEditing:)]; _delegateHas.didBeginEditing = [theDelegate respondsToSelector:@selector(textViewDidBeginEditing:)]; _delegateHas.shouldEndEditing = [theDelegate respondsToSelector:@selector(textViewShouldEndEditing:)]; _delegateHas.didEndEditing = [theDelegate respondsToSelector:@selector(textViewDidEndEditing:)]; _delegateHas.shouldChangeText = [theDelegate respondsToSelector:@selector(textView:shouldChangeTextInRange:replacementText:)]; _delegateHas.didChange = [theDelegate respondsToSelector:@selector(textViewDidChange:)]; _delegateHas.didChangeSelection = [theDelegate respondsToSelector:@selector(textViewDidChangeSelection:)]; } } - (BOOL)_textShouldBeginEditing { return _delegateHas.shouldBeginEditing? [self.delegate textViewShouldBeginEditing:self] : YES; } - (void)_textDidBeginEditing { if (_delegateHas.didBeginEditing) { [self.delegate textViewDidBeginEditing:self]; } [[NSNotificationCenter defaultCenter] postNotificationName:UITextViewTextDidBeginEditingNotification object:self]; } - (BOOL)_textShouldEndEditing { return _delegateHas.shouldEndEditing? [self.delegate textViewShouldEndEditing:self] : YES; } - (void)_textDidEndEditing { if (_delegateHas.didEndEditing) { [self.delegate textViewDidEndEditing:self]; } [[NSNotificationCenter defaultCenter] postNotificationName:UITextViewTextDidEndEditingNotification object:self]; } - (BOOL)_textShouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text { return _delegateHas.shouldChangeText? [self.delegate textView:self shouldChangeTextInRange:range replacementText:text] : YES; } - (void)_textDidChange { if (_delegateHas.didChange) { [self.delegate textViewDidChange:self]; } [[NSNotificationCenter defaultCenter] postNotificationName:UITextViewTextDidChangeNotification object:self]; } - (void)_textDidChangeSelection { if (_delegateHas.didChangeSelection) { [self.delegate textViewDidChangeSelection:self]; } } - (NSString *)description { NSString *textAlignment = @""; switch (self.textAlignment) { case UITextAlignmentLeft: textAlignment = @"Left"; break; case UITextAlignmentCenter: textAlignment = @"Center"; break; case UITextAlignmentRight: textAlignment = @"Right"; break; } return [NSString stringWithFormat:@"<%@: %p; textAlignment = %@; selectedRange = %@; editable = %@; textColor = %@; font = %@; delegate = %@>", [self className], self, textAlignment, NSStringFromRange(self.selectedRange), (self.editable ? @"YES" : @"NO"), self.textColor, self.font, self.delegate]; } - (id)mouseCursorForEvent:(UIEvent *)event { return self.editable? [NSCursor IBeamCursor] : nil; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIThreePartImage.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIImage+UIPrivate.h" @interface UIThreePartImage : UIImage { @private NSInteger _capSize; BOOL _vertical; } - (id)initWithRepresentations:(NSArray *)reps capSize:(NSInteger)capSize vertical:(BOOL)isVertical; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIThreePartImage.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIThreePartImage.h" #import "UIImageRep.h" @implementation UIThreePartImage - (id)initWithRepresentations:(NSArray *)reps capSize:(NSInteger)capSize vertical:(BOOL)isVertical { if ((self=[super _initWithRepresentations:reps])) { _capSize = capSize; _vertical = isVertical; } return self; } - (NSInteger)leftCapWidth { return _vertical? 0 : _capSize; } - (NSInteger)topCapHeight { return _vertical? _capSize : 0; } - (void)_drawRepresentation:(UIImageRep *)rep inRect:(CGRect)rect { const CGSize size = self.size; if ((_vertical && size.height >= rect.size.height) || (!_vertical && size.width >= rect.size.width)) { [super _drawRepresentation:rep inRect:rect]; } else if (_vertical) { const CGFloat stretchyHeight = (_capSize < size.height)? 1 : 0; const CGFloat bottomCapHeight = size.height - _capSize - stretchyHeight; [rep drawInRect:CGRectMake(CGRectGetMinX(rect), CGRectGetMinY(rect), rect.size.width, _capSize) fromRect:CGRectMake(0, 0, size.width, _capSize)]; [rep drawInRect:CGRectMake(CGRectGetMinX(rect), CGRectGetMinY(rect)+_capSize, rect.size.width, rect.size.height-_capSize-bottomCapHeight) fromRect:CGRectMake(0, _capSize, size.width, stretchyHeight)]; [rep drawInRect:CGRectMake(CGRectGetMinX(rect), CGRectGetMaxY(rect)-bottomCapHeight, rect.size.width, bottomCapHeight) fromRect:CGRectMake(0, size.height-bottomCapHeight, size.width, bottomCapHeight)]; } else { const CGFloat stretchyWidth = (_capSize < size.width)? 1 : 0; const CGFloat rightCapWidth = size.width - _capSize - stretchyWidth; [rep drawInRect:CGRectMake(CGRectGetMinX(rect), CGRectGetMinY(rect), _capSize, rect.size.height) fromRect:CGRectMake(0, 0, _capSize, size.height)]; [rep drawInRect:CGRectMake(CGRectGetMinX(rect)+_capSize, CGRectGetMinY(rect), rect.size.width-_capSize-rightCapWidth, rect.size.height) fromRect:CGRectMake(_capSize, 0, stretchyWidth, size.height)]; [rep drawInRect:CGRectMake(CGRectGetMinX(rect)+rect.size.width-rightCapWidth, CGRectGetMinY(rect), rightCapWidth, rect.size.height) fromRect:CGRectMake(size.width-rightCapWidth, 0, rightCapWidth, size.height)]; } } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIToolbar.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIView.h" #import "UIInterface.h" typedef enum { UIToolbarPositionAny = 0, UIToolbarPositionBottom = 1, UIToolbarPositionTop = 2, } UIToolbarPosition; @interface UIToolbar : UIView { @private UIBarStyle _barStyle; UIColor *_tintColor; NSMutableArray *_toolbarItems; BOOL _translucent; } - (void)setItems:(NSArray *)items animated:(BOOL)animated; @property (nonatomic) UIBarStyle barStyle; @property (nonatomic, strong) UIColor *tintColor; @property (nonatomic, copy) NSArray *items; @property (nonatomic,assign,getter=isTranslucent) BOOL translucent; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIToolbar.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIToolbar.h" #import "UIBarButtonItem.h" #import "UIToolbarButton.h" #import "UIColor.h" #import "UIGraphics.h" @interface UIToolbarItem : NSObject { UIBarButtonItem *item; UIView *view; } - (id)initWithBarButtonItem:(UIBarButtonItem *)anItem; @property (nonatomic, readonly) UIView *view; @property (nonatomic, readonly) UIBarButtonItem *item; @property (nonatomic, readonly) CGFloat width; @end @implementation UIToolbarItem @synthesize item, view; - (id)initWithBarButtonItem:(UIBarButtonItem *)anItem { if ((self=[super init])) { NSAssert((anItem != nil), @"the bar button item must not be nil"); item = [anItem retain]; if (!item->_isSystemItem && item.customView) { view = [item.customView retain]; } else if (!item->_isSystemItem || (item->_systemItem != UIBarButtonSystemItemFixedSpace && item->_systemItem != UIBarButtonSystemItemFlexibleSpace)) { view = [[UIToolbarButton alloc] initWithBarButtonItem:item]; } } return self; } - (void)dealloc { [item release]; [view release]; [super dealloc]; } - (CGFloat)width { if (view) { return view.frame.size.width; } else if (item->_isSystemItem && item->_systemItem == UIBarButtonSystemItemFixedSpace) { return item.width; } else { return -1; } } @end @implementation UIToolbar @synthesize barStyle=_barStyle, tintColor=_tintColor, translucent=_translucent; - (id)init { return [self initWithFrame:CGRectMake(0,0,320,32)]; } - (id)initWithFrame:(CGRect)frame { if ((self=[super initWithFrame:frame])) { _toolbarItems = [[NSMutableArray alloc] init]; self.barStyle = UIBarStyleDefault; self.translucent = NO; self.tintColor = nil; } return self; } - (void)dealloc { [_tintColor release]; [_toolbarItems release]; [super dealloc]; } - (void)setBarStyle:(UIBarStyle)newStyle { _barStyle = newStyle; // this is for backward compatibility - UIBarStyleBlackTranslucent is deprecated if (_barStyle == UIBarStyleBlackTranslucent) { self.translucent = YES; } } /* - (void)_updateItemViews { [_itemViews makeObjectsPerformSelector:@selector(removeFromSuperview)]; [_itemViews removeAllObjects]; NSUInteger numberOfFlexibleItems = 0; for (UIBarButtonItem *item in _items) { if ((item->_isSystemItem) && (item->_systemItem == UIBarButtonSystemItemFlexibleSpace)) { numberOfFlexibleItems++; } } const CGSize size = self.bounds.size; const CGFloat flexibleSpaceWidth = (numberOfFlexibleItems > 0)? MAX(0, size.width/numberOfFlexibleItems) : 0; CGFloat left = 0; for (UIBarButtonItem *item in _items) { UIView *view = item.customView; if (!view) { if (item->_isSystemItem && item->_systemItem == UIBarButtonSystemItemFlexibleSpace) { left += flexibleSpaceWidth; } else if (item->_isSystemItem && item->_systemItem == UIBarButtonSystemItemFixedSpace) { left += item.width; } else { view = [[[UIToolbarButton alloc] initWithBarButtonItem:item] autorelease]; } } if (view) { CGRect frame = view.frame; frame.origin.x = left; frame.origin.y = (size.height / 2.f) - (frame.size.height / 2.f); frame = CGRectStandardize(frame); view.frame = frame; left += frame.size.width; [self addSubview:view]; } } } */ - (void)layoutSubviews { [super layoutSubviews]; CGFloat itemWidth = 0; NSUInteger numberOfFlexibleItems = 0; for (UIToolbarItem *toolbarItem in _toolbarItems) { const CGFloat width = toolbarItem.width; if (width >= 0) { itemWidth += width; } else { numberOfFlexibleItems++; } } const CGSize size = self.bounds.size; const CGFloat flexibleSpaceWidth = (numberOfFlexibleItems > 0)? ((size.width - itemWidth) / numberOfFlexibleItems) : 0; const CGFloat centerY = size.height / 2.f; CGFloat x = 0; for (UIToolbarItem *toolbarItem in _toolbarItems) { UIView *view = toolbarItem.view; const CGFloat width = toolbarItem.width; if (view) { CGRect frame = view.frame; frame.origin.x = x; frame.origin.y = floorf(centerY - (frame.size.height / 2.f)); view.frame = frame; } if (width < 0) { x += flexibleSpaceWidth; } else { x += width; } } } - (void)setItems:(NSArray *)newItems animated:(BOOL)animated { if (![self.items isEqualToArray:newItems]) { // if animated, fade old item views out, otherwise just remove them for (UIToolbarItem *toolbarItem in _toolbarItems) { UIView *view = toolbarItem.view; if (view) { [UIView animateWithDuration:animated? 0.2 : 0 animations:^(void) { view.alpha = 0; } completion:^(BOOL finished) { [view removeFromSuperview]; }]; } } [_toolbarItems removeAllObjects]; for (UIBarButtonItem *item in newItems) { UIToolbarItem *toolbarItem = [[UIToolbarItem alloc] initWithBarButtonItem:item]; [_toolbarItems addObject:toolbarItem]; [self addSubview:toolbarItem.view]; [toolbarItem release]; } // if animated, fade them in if (animated) { for (UIToolbarItem *toolbarItem in _toolbarItems) { UIView *view = toolbarItem.view; if (view) { view.alpha = 0; [UIView animateWithDuration:0.2 animations:^(void) { view.alpha = 1; }]; } } } } } - (void)setItems:(NSArray *)items { [self setItems:items animated:NO]; } - (NSArray *)items { return [_toolbarItems valueForKey:@"item"]; } - (void)drawRect:(CGRect)rect { const CGRect bounds = self.bounds; UIColor *color = _tintColor ?: [UIColor colorWithRed:21/255.f green:21/255.f blue:25/255.f alpha:1]; [color setFill]; UIRectFill(bounds); [[UIColor blackColor] setFill]; UIRectFill(CGRectMake(0,0,bounds.size.width,1)); } - (NSString *)description { NSString *barStyle = @""; switch (self.barStyle) { case UIBarStyleDefault: barStyle = @"Default"; break; case UIBarStyleBlack: barStyle = @"Black"; break; case UIBarStyleBlackTranslucent: barStyle = @"Black Translucent (Deprecated)"; break; } return [NSString stringWithFormat:@"<%@: %p; barStyle = %@; tintColor = %@, isTranslucent = %@>", [self className], self, barStyle, ([self.tintColor description] ?: @"Default"), (self.translucent ? @"YES" : @"NO")]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIToolbarButton.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIButton.h" @class UIBarButtonItem; @interface UIToolbarButton : UIButton { } - (id)initWithBarButtonItem:(UIBarButtonItem *)item; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIToolbarButton.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIToolbarButton.h" #import "UIBarButtonItem.h" #import "UIImage+UIPrivate.h" #import "UILabel.h" #import "UIFont.h" // I don't like most of this... the real toolbar button lays things out different than a default button. // It also seems to have some padding built into it around the whole thing (even the background) // It centers images vertical and horizontal if not bordered, but it appears to be top-aligned if it's bordered // If you specify both an image and a title, these buttons stack them vertically which is unlike default UIButton behavior // This is all a pain in the ass and wrong, but good enough for now, I guess static UIEdgeInsets UIToolbarButtonInset = {0,4,0,4}; @implementation UIToolbarButton - (id)initWithBarButtonItem:(UIBarButtonItem *)item { NSAssert(item != nil, @"bar button item must not be nil"); CGRect frame = CGRectMake(0,0,24,24); if ((self=[super initWithFrame:frame])) { UIImage *image = nil; NSString *title = nil; if (item->_isSystemItem) { switch (item->_systemItem) { case UIBarButtonSystemItemAdd: image = [UIImage _buttonBarSystemItemAdd]; break; case UIBarButtonSystemItemReply: image = [UIImage _buttonBarSystemItemReply]; break; default: break; } } else { image = [item.image _toolbarImage]; title = item.title; if (item.style == UIBarButtonItemStyleBordered) { self.titleLabel.font = [UIFont systemFontOfSize:11]; [self setBackgroundImage:[UIImage _toolbarButtonImage] forState:UIControlStateNormal]; [self setBackgroundImage:[UIImage _highlightedToolbarButtonImage] forState:UIControlStateHighlighted]; self.contentEdgeInsets = UIEdgeInsetsMake(0,7,0,7); self.titleEdgeInsets = UIEdgeInsetsMake(4,0,0,0); self.clipsToBounds = YES; self.contentVerticalAlignment = UIControlContentVerticalAlignmentTop; } } [self setImage:image forState:UIControlStateNormal]; [self setTitle:title forState:UIControlStateNormal]; [self addTarget:item.target action:item.action forControlEvents:UIControlEventTouchUpInside]; // resize the view to fit according to the rules, which appear to be that if the width is set directly in the item, use that // value, otherwise size to fit - but cap the total height, I guess? CGSize fitToSize = frame.size; if (item.width > 0) { frame.size.width = item.width; } else { frame.size.width = [self sizeThatFits:fitToSize].width; } self.frame = frame; } return self; } - (CGRect)backgroundRectForBounds:(CGRect)bounds { return UIEdgeInsetsInsetRect(bounds, UIToolbarButtonInset); } - (CGRect)contentRectForBounds:(CGRect)bounds { return UIEdgeInsetsInsetRect(bounds, UIToolbarButtonInset); } - (CGSize)sizeThatFits:(CGSize)fitSize { fitSize = [super sizeThatFits:fitSize]; fitSize.width += UIToolbarButtonInset.left + UIToolbarButtonInset.right; fitSize.height += UIToolbarButtonInset.top + UIToolbarButtonInset.bottom; return fitSize; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UITouch+UIPrivate.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UITouch.h" @class UIView; @interface UITouch (UIPrivate) - (void)_setPhase:(UITouchPhase)phase screenLocation:(CGPoint)screenLocation tapCount:(NSUInteger)tapCount timestamp:(NSTimeInterval)timestamp; - (void)_updatePhase:(UITouchPhase)phase screenLocation:(CGPoint)screenLocation timestamp:(NSTimeInterval)timestamp; - (void)_updateGesture:(_UITouchGesture)gesture screenLocation:(CGPoint)screenLocation delta:(CGPoint)delta rotation:(CGFloat)rotation magnification:(CGFloat)magnification timestamp:(NSTimeInterval)timestamp; - (void)_setDiscreteGesture:(_UITouchGesture)gesture screenLocation:(CGPoint)screenLocation tapCount:(NSUInteger)tapCount delta:(CGPoint)delta timestamp:(NSTimeInterval)timestamp; - (void)_setTouchedView:(UIView *)view; // sets up the window and gesture recognizers as well - (void)_removeFromView; // sets the initial view to nil, but leaves window and gesture recognizers alone - used when a view is removed while touch is active - (void)_setTouchPhaseCancelled; - (CGPoint)_delta; - (CGFloat)_rotation; - (CGFloat)_magnification; - (UIView *)_previousView; - (_UITouchGesture)_gesture; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UITouch.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import typedef enum { UITouchPhaseBegan, UITouchPhaseMoved, UITouchPhaseStationary, UITouchPhaseEnded, UITouchPhaseCancelled, _UITouchPhaseGestureBegan, _UITouchPhaseGestureChanged, _UITouchPhaseGestureEnded, _UITouchPhaseDiscreteGesture } UITouchPhase; typedef enum { _UITouchGestureUnknown = 0, _UITouchGesturePan, // maps only to touch-enabled scrolling devices like magic trackpad, etc. for older wheels, use _UITouchGestureScrollWheel _UITouchGestureRotation, // only works for touch-enabled input devices _UITouchGesturePinch, // only works for touch-enabled input devices _UITouchGestureSwipe, // only works for touch-enabled input devices (this is actually discrete, but OSX sends gesture begin/end events around it) _UITouchDiscreteGestureRightClick, // should be pretty obvious _UITouchDiscreteGestureScrollWheel, // this is used by old fashioned wheel mice or when the OS sends its automatic momentum scroll events _UITouchDiscreteGestureMouseMove // the mouse moved but wasn't in a gesture or the button was not being held down } _UITouchGesture; @class UIView, UIWindow; @interface UITouch : NSObject { @private NSTimeInterval _timestamp; NSUInteger _tapCount; UITouchPhase _phase; _UITouchGesture _gesture; CGPoint _delta; CGFloat _rotation; CGFloat _magnification; CGPoint _location; CGPoint _previousLocation; UIView *_view; UIWindow *_window; NSArray *_gestureRecognizers; } - (CGPoint)locationInView:(UIView *)inView; - (CGPoint)previousLocationInView:(UIView *)inView; @property (nonatomic, readonly) NSTimeInterval timestamp; @property (nonatomic, readonly) NSUInteger tapCount; @property (nonatomic, readonly) UITouchPhase phase; @property (nonatomic, readonly, strong) UIView *view; @property (nonatomic, readonly, strong) UIWindow *window; @property (nonatomic,readonly,copy) NSArray *gestureRecognizers; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UITouch.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UITouch+UIPrivate.h" #import "UIWindow.h" #import "UIGestureRecognizerSubclass.h" #import static NSArray *GestureRecognizersForView(UIView *view) { NSMutableArray *recognizers = [[NSMutableArray alloc] initWithCapacity:0]; while (view) { [recognizers addObjectsFromArray:view.gestureRecognizers]; view = [view superview]; } return [recognizers autorelease]; } @implementation UITouch @synthesize timestamp=_timestamp, tapCount=_tapCount, phase=_phase, view=_view, window=_window, gestureRecognizers=_gestureRecognizers; - (id)init { if ((self=[super init])) { _phase = UITouchPhaseCancelled; _gesture = _UITouchGestureUnknown; } return self; } - (void)dealloc { [_window release]; [_view release]; [_gestureRecognizers release]; [super dealloc]; } - (void)_setPhase:(UITouchPhase)phase screenLocation:(CGPoint)screenLocation tapCount:(NSUInteger)tapCount timestamp:(NSTimeInterval)timestamp; { _phase = phase; _gesture = _UITouchGestureUnknown; _previousLocation = _location = screenLocation; _tapCount = tapCount; _timestamp = timestamp; _rotation = 0; _magnification = 0; } - (void)_updatePhase:(UITouchPhase)phase screenLocation:(CGPoint)screenLocation timestamp:(NSTimeInterval)timestamp; { if (!CGPointEqualToPoint(screenLocation, _location)) { _previousLocation = _location; _location = screenLocation; } _phase = phase; _timestamp = timestamp; } - (void)_updateGesture:(_UITouchGesture)gesture screenLocation:(CGPoint)screenLocation delta:(CGPoint)delta rotation:(CGFloat)rotation magnification:(CGFloat)magnification timestamp:(NSTimeInterval)timestamp; { if (!CGPointEqualToPoint(screenLocation, _location)) { _previousLocation = _location; _location = screenLocation; } _phase = _UITouchPhaseGestureChanged; _gesture = gesture; _delta = delta; _rotation = rotation; _magnification = magnification; _timestamp = timestamp; } - (void)_setDiscreteGesture:(_UITouchGesture)gesture screenLocation:(CGPoint)screenLocation tapCount:(NSUInteger)tapCount delta:(CGPoint)delta timestamp:(NSTimeInterval)timestamp; { _phase = _UITouchPhaseDiscreteGesture; _gesture = gesture; _previousLocation = _location = screenLocation; _tapCount = tapCount; _delta = delta; _timestamp = timestamp; _rotation = 0; _magnification = 0; } - (_UITouchGesture)_gesture { return _gesture; } - (void)_setTouchedView:(UIView *)view { if (_view != view) { [_view release]; _view = [view retain]; } if (_window != view.window) { [_window release]; _window = [view.window retain]; } [_gestureRecognizers release]; _gestureRecognizers = [GestureRecognizersForView(_view) copy]; } - (void)_removeFromView { NSMutableArray *remainingRecognizers = [_gestureRecognizers mutableCopy]; // if the view is being removed from this touch, we need to remove/cancel any gesture recognizers that belong to the view // being removed. this kinda feels like the wrong place for this, but the touch itself has a list of potential gesture // recognizers attached to it so an active touch only considers the recongizers that were present at the point the touch // first touched the screen. it could easily have recognizers attached to it from superviews of the view being removed so // we can't just cancel them all. the view itself could cancel its own recognizers, but then it needs a way to remove them // from an active touch so in a sense we're right back where we started. so I figured we might as well just take care of it // here and see what happens. for (UIGestureRecognizer *recognizer in _gestureRecognizers) { if (recognizer.view == _view) { if (recognizer.state == UIGestureRecognizerStateBegan || recognizer.state == UIGestureRecognizerStateChanged) { recognizer.state = UIGestureRecognizerStateCancelled; } [remainingRecognizers removeObject:recognizer]; } } [_gestureRecognizers release]; _gestureRecognizers = [remainingRecognizers copy]; [remainingRecognizers release]; [_view release]; _view = nil; } - (void)_setTouchPhaseCancelled { _phase = UITouchPhaseCancelled; } - (CGPoint)_delta { return _delta; } - (CGFloat)_rotation { return _rotation; } - (CGFloat)_magnification { return _magnification; } - (UIWindow *)window { return _window; } - (CGPoint)_convertLocationPoint:(CGPoint)thePoint toView:(UIView *)inView { UIWindow *window = self.window; // The stored location should always be in the coordinate space of the UIScreen that contains the touch's window. // So first convert from the screen to the window: CGPoint point = [window convertPoint:thePoint fromWindow:nil]; // Then convert to the desired location (if any). if (inView) { point = [inView convertPoint:point fromView:window]; } return point; } - (CGPoint)locationInView:(UIView *)inView { return [self _convertLocationPoint:_location toView:inView]; } - (CGPoint)previousLocationInView:(UIView *)inView { return [self _convertLocationPoint:_previousLocation toView:inView]; } - (NSString *)description { NSString *phase = @""; switch (self.phase) { case UITouchPhaseBegan: phase = @"Began"; break; case UITouchPhaseMoved: phase = @"Moved"; break; case UITouchPhaseStationary: phase = @"Stationary"; break; case UITouchPhaseEnded: phase = @"Ended"; break; case UITouchPhaseCancelled: phase = @"Cancelled"; break; case _UITouchPhaseGestureBegan: phase = @"GestureBegan"; break; case _UITouchPhaseGestureChanged: phase = @"GestureChanged"; break; case _UITouchPhaseGestureEnded: phase = @"GestureEnded"; break; case _UITouchPhaseDiscreteGesture: phase = @"DiscreteGesture"; break; } return [NSString stringWithFormat:@"<%@: %p; timestamp = %e; tapCount = %lu; phase = %@; view = %@; window = %@>", [self className], self, self.timestamp, (unsigned long)self.tapCount, phase, self.view, self.window]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UITransitionView.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIView.h" typedef enum { UITransitionNone = 0, // no animation is done UITransitionFromLeft, // the new view slides in from the left over top of the old view UITransitionFromRight, // the new view slides in from the right over top of the old view UITransitionFromTop, // the new view slides in from the top over top of the old view UITransitionFromBottom, // the new view slides in from the bottom over top of the old view UITransitionPushLeft, // the new view slides in from the right and pushes the old view off the left UITransitionPushRight, // the new view slides in from the left and pushes the old view off the right UITransitionPushUp, // the new view slides in from the bottom and pushes the old view off the top UITransitionPushDown, // the new view slides in from the top and pushes the old view off the bottom UITransitionCrossFade, // new view fades in as old view fades out UITransitionFadeIn, // new view fades in over old view UITransitionFadeOut // old view fades out to reveal the new view behind it } UITransition; @class UITransitionView; @protocol UITransitionViewDelegate - (void)transitionView:(UITransitionView *)transitionView didTransitionFromView:(UIView *)fromView toView:(UIView *)toView withTransition:(UITransition)transition; @end @interface UITransitionView : UIView { UITransition _transition; UIView *_view; __unsafe_unretained id _delegate; } - (id)initWithFrame:(CGRect)frame view:(UIView *)aView; @property (nonatomic, strong) UIView *view; @property (nonatomic, assign) UITransition transition; @property (nonatomic, assign) id delegate; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UITransitionView.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UITransitionView.h" @implementation UITransitionView @synthesize view=_view, transition=_transition, delegate=_delegate; - (id)initWithFrame:(CGRect)frame view:(UIView *)aView { if ((self=[super initWithFrame:frame])) { self.view = aView; } return self; } - (void)dealloc { [_view release]; [super dealloc]; } - (void)setFrame:(CGRect)frame { [super setFrame:frame]; _view.frame = self.bounds; } - (CGRect)_rectForIncomingView { switch (_transition) { case UITransitionPushRight: case UITransitionFromLeft: return CGRectOffset(self.bounds,-self.bounds.size.width,0); case UITransitionPushLeft: case UITransitionFromRight: return CGRectOffset(self.bounds,self.bounds.size.width,0); case UITransitionPushDown: case UITransitionFromTop: return CGRectOffset(self.bounds,0,-self.bounds.size.height); case UITransitionPushUp: case UITransitionFromBottom: return CGRectOffset(self.bounds,0,self.bounds.size.height); default: return self.bounds; } } - (CGRect)_rectForOutgoingView { switch (_transition) { case UITransitionPushLeft: return CGRectOffset(self.bounds,-self.bounds.size.width,0); case UITransitionPushRight: return CGRectOffset(self.bounds,self.bounds.size.width,0); case UITransitionPushDown: return CGRectOffset(self.bounds,0,self.bounds.size.height); case UITransitionPushUp: return CGRectOffset(self.bounds,0,-self.bounds.size.height); default: return self.bounds; } } - (void)_finishTransition:(NSDictionary *)info { UIView *fromView = [info objectForKey:@"fromView"]; UIView *toView = [info objectForKey:@"toView"]; UITransition transition = [[info objectForKey:@"transition"] intValue]; [fromView removeFromSuperview]; [_delegate transitionView:self didTransitionFromView:fromView toView:toView withTransition:transition]; } - (void)setView:(UIView *)aView { if (aView != _view) { aView.frame = [self _rectForIncomingView]; [self addSubview:aView]; NSDictionary *info = [NSDictionary dictionaryWithObjectsAndKeys: _view, @"fromView", aView, @"toView", [NSNumber numberWithInt:_transition], @"transition", nil]; if (_transition == UITransitionNone) { [self _finishTransition:info]; } else { if (_transition == UITransitionFadeOut) { [self sendSubviewToBack:aView]; } else if (_transition == UITransitionFadeIn) { aView.alpha = 0; } [UIView animateWithDuration:0.33 animations:^(void) { _view.frame = [self _rectForOutgoingView]; aView.frame = self.bounds; if (_transition == UITransitionFadeOut || _transition == UITransitionCrossFade) { _view.alpha = 0; } if (_transition == UITransitionFadeIn || _transition == UITransitionCrossFade) { aView.alpha = 1; } } completion:^(BOOL finished) { [self _finishTransition:info]; }]; } [_view release]; _view = [aView retain]; } } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIView+UIPrivate.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIView.h" extern NSString *const UIViewFrameDidChangeNotification; extern NSString *const UIViewBoundsDidChangeNotification; extern NSString *const UIViewDidMoveToSuperviewNotification; extern NSString *const UIViewHiddenDidChangeNotification; @interface UIView (UIPrivate) - (void)_removeFromSuperview:(BOOL)notifyViewController; - (void)_setViewController:(UIViewController *)theViewController; - (UIViewController *)_viewController; - (void)_superviewSizeDidChangeFrom:(CGSize)oldSize to:(CGSize)newSize; - (void)_layoutSubviews; - (void)_didMoveToScreen; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIView.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIResponder.h" #import "UIGeometry.h" #import "UIAppearance.h" enum { UIViewAutoresizingNone = 0, UIViewAutoresizingFlexibleLeftMargin = 1 << 0, UIViewAutoresizingFlexibleWidth = 1 << 1, UIViewAutoresizingFlexibleRightMargin = 1 << 2, UIViewAutoresizingFlexibleTopMargin = 1 << 3, UIViewAutoresizingFlexibleHeight = 1 << 4, UIViewAutoresizingFlexibleBottomMargin = 1 << 5 }; typedef NSUInteger UIViewAutoresizing; typedef enum { UIViewContentModeScaleToFill, UIViewContentModeScaleAspectFit, UIViewContentModeScaleAspectFill, UIViewContentModeRedraw, UIViewContentModeCenter, UIViewContentModeTop, UIViewContentModeBottom, UIViewContentModeLeft, UIViewContentModeRight, UIViewContentModeTopLeft, UIViewContentModeTopRight, UIViewContentModeBottomLeft, UIViewContentModeBottomRight, } UIViewContentMode; typedef enum { UIViewAnimationCurveEaseInOut, UIViewAnimationCurveEaseIn, UIViewAnimationCurveEaseOut, UIViewAnimationCurveLinear } UIViewAnimationCurve; typedef enum { UIViewAnimationTransitionNone, UIViewAnimationTransitionFlipFromLeft, UIViewAnimationTransitionFlipFromRight, UIViewAnimationTransitionCurlUp, UIViewAnimationTransitionCurlDown, } UIViewAnimationTransition; enum { UIViewAnimationOptionLayoutSubviews = 1 << 0, // not currently supported UIViewAnimationOptionAllowUserInteraction = 1 << 1, UIViewAnimationOptionBeginFromCurrentState = 1 << 2, UIViewAnimationOptionRepeat = 1 << 3, UIViewAnimationOptionAutoreverse = 1 << 4, UIViewAnimationOptionOverrideInheritedDuration = 1 << 5, // not currently supported UIViewAnimationOptionOverrideInheritedCurve = 1 << 6, // not currently supported UIViewAnimationOptionAllowAnimatedContent = 1 << 7, // not currently supported UIViewAnimationOptionShowHideTransitionViews = 1 << 8, // not currently supported UIViewAnimationOptionCurveEaseInOut = 0 << 16, UIViewAnimationOptionCurveEaseIn = 1 << 16, UIViewAnimationOptionCurveEaseOut = 2 << 16, UIViewAnimationOptionCurveLinear = 3 << 16, UIViewAnimationOptionTransitionNone = 0 << 20, // not currently supported UIViewAnimationOptionTransitionFlipFromLeft = 1 << 20, // not currently supported UIViewAnimationOptionTransitionFlipFromRight = 2 << 20, // not currently supported UIViewAnimationOptionTransitionCurlUp = 3 << 20, // not currently supported UIViewAnimationOptionTransitionCurlDown = 4 << 20, // not currently supported UIViewAnimationOptionTransitionCrossDissolve = 5 << 20, // not currently supported UIViewAnimationOptionTransitionFlipFromTop = 6 << 20, // not currently supported UIViewAnimationOptionTransitionFlipFromBottom = 7 << 20, // not currently supported }; typedef NSUInteger UIViewAnimationOptions; @class UIColor, CALayer, UIViewController, UIGestureRecognizer; @interface UIView : UIResponder { @private UIView *_superview; NSMutableSet *_subviews; BOOL _clearsContextBeforeDrawing; BOOL _autoresizesSubviews; BOOL _userInteractionEnabled; CALayer *_layer; NSInteger _tag; UIViewContentMode _contentMode; UIColor *_backgroundColor; BOOL _implementsDrawRect; BOOL _multipleTouchEnabled; BOOL _exclusiveTouch; UIViewController *_viewController; UIViewAutoresizing _autoresizingMask; BOOL _needsDidAppearOrDisappear; NSMutableSet *_gestureRecognizers; } + (Class)layerClass; - (id)initWithFrame:(CGRect)frame; - (void)addSubview:(UIView *)subview; - (void)insertSubview:(UIView *)subview atIndex:(NSInteger)index; - (void)insertSubview:(UIView *)subview belowSubview:(UIView *)below; - (void)insertSubview:(UIView *)subview aboveSubview:(UIView *)above; - (void)removeFromSuperview; - (void)bringSubviewToFront:(UIView *)subview; - (void)sendSubviewToBack:(UIView *)subview; - (CGRect)convertRect:(CGRect)toConvert fromView:(UIView *)fromView; - (CGRect)convertRect:(CGRect)toConvert toView:(UIView *)toView; - (CGPoint)convertPoint:(CGPoint)toConvert fromView:(UIView *)fromView; - (CGPoint)convertPoint:(CGPoint)toConvert toView:(UIView *)toView; - (void)setNeedsDisplay; - (void)setNeedsDisplayInRect:(CGRect)invalidRect; - (void)drawRect:(CGRect)rect; - (void)sizeToFit; - (CGSize)sizeThatFits:(CGSize)size; - (void)setNeedsLayout; - (void)layoutIfNeeded; - (void)layoutSubviews; - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event; - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event; - (UIView *)viewWithTag:(NSInteger)tag; - (BOOL)isDescendantOfView:(UIView *)view; - (void)addGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer; // not implemented - (void)removeGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer; // not implemented - (void)didAddSubview:(UIView *)subview; - (void)didMoveToSuperview; - (void)didMoveToWindow; - (void)willMoveToSuperview:(UIView *)newSuperview; - (void)willMoveToWindow:(UIWindow *)newWindow; - (void)willRemoveSubview:(UIView *)subview; + (void)animateWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion; + (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion; + (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations; // the block-based transition methods are not currently implemented + (void)transitionWithView:(UIView *)view duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion; + (void)transitionFromView:(UIView *)fromView toView:(UIView *)toView duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options completion:(void (^)(BOOL finished))completion; + (void)beginAnimations:(NSString *)animationID context:(void *)context; + (void)commitAnimations; + (void)setAnimationBeginsFromCurrentState:(BOOL)beginFromCurrentState; + (void)setAnimationCurve:(UIViewAnimationCurve)curve; + (void)setAnimationDelay:(NSTimeInterval)delay; + (void)setAnimationDelegate:(id)delegate; + (void)setAnimationDidStopSelector:(SEL)selector; + (void)setAnimationDuration:(NSTimeInterval)duration; + (void)setAnimationRepeatAutoreverses:(BOOL)repeatAutoreverses; + (void)setAnimationRepeatCount:(float)repeatCount; + (void)setAnimationTransition:(UIViewAnimationTransition)transition forView:(UIView *)view cache:(BOOL)cache; + (void)setAnimationWillStartSelector:(SEL)selector; + (BOOL)areAnimationsEnabled; + (void)setAnimationsEnabled:(BOOL)enabled; @property (nonatomic) CGRect frame; @property (nonatomic) CGRect bounds; @property (nonatomic) CGPoint center; @property (nonatomic) CGAffineTransform transform; @property (nonatomic, readonly) UIView *superview; @property (nonatomic, readonly) UIWindow *window; @property (nonatomic, readonly) NSArray *subviews; @property (nonatomic) CGFloat alpha; @property (nonatomic, getter=isOpaque) BOOL opaque; @property (nonatomic) BOOL clearsContextBeforeDrawing; @property (nonatomic, copy) UIColor *backgroundColor; @property (nonatomic, readonly) CALayer *layer; @property (nonatomic) BOOL clipsToBounds; @property (nonatomic) BOOL autoresizesSubviews; @property (nonatomic) UIViewAutoresizing autoresizingMask; @property (nonatomic) CGRect contentStretch; @property (nonatomic) NSInteger tag; @property (nonatomic, getter=isHidden) BOOL hidden; @property (nonatomic, getter=isUserInteractionEnabled) BOOL userInteractionEnabled; @property (nonatomic) UIViewContentMode contentMode; @property (nonatomic) CGFloat contentScaleFactor; @property (nonatomic, getter=isMultipleTouchEnabled) BOOL multipleTouchEnabled; // state is maintained, but it has no effect @property (nonatomic, getter=isExclusiveTouch) BOOL exclusiveTouch; // state is maintained, but it has no effect @property (nonatomic,copy) NSArray *gestureRecognizers; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIView.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIView+UIPrivate.h" #import "UIWindow.h" #import "UIGraphics.h" #import "UIColor.h" #import "UIViewLayoutManager.h" #import "UIViewAnimationGroup.h" #import "UIViewBlockAnimationDelegate.h" #import "UIViewController.h" #import "UIAppearanceInstance.h" #import "UIApplication+UIPrivate.h" #import "UIGestureRecognizer+UIPrivate.h" #import "UIScreen.h" #import "UIColor+UIPrivate.h" #import "UIColorRep.h" #import NSString *const UIViewFrameDidChangeNotification = @"UIViewFrameDidChangeNotification"; NSString *const UIViewBoundsDidChangeNotification = @"UIViewBoundsDidChangeNotification"; NSString *const UIViewDidMoveToSuperviewNotification = @"UIViewDidMoveToSuperviewNotification"; NSString *const UIViewHiddenDidChangeNotification = @"UIViewHiddenDidChangeNotification"; static NSMutableArray *_animationGroups; static BOOL _animationsEnabled = YES; @implementation UIView @synthesize layer=_layer, superview=_superview, clearsContextBeforeDrawing=_clearsContextBeforeDrawing, autoresizesSubviews=_autoresizesSubviews; @synthesize tag=_tag, userInteractionEnabled=_userInteractionEnabled, contentMode=_contentMode, backgroundColor=_backgroundColor; @synthesize multipleTouchEnabled=_multipleTouchEnabled, exclusiveTouch=_exclusiveTouch, autoresizingMask=_autoresizingMask; + (void)initialize { if (self == [UIView class]) { _animationGroups = [[NSMutableArray alloc] init]; } } + (Class)layerClass { return [CALayer class]; } + (BOOL)_instanceImplementsDrawRect { return [UIView instanceMethodForSelector:@selector(drawRect:)] != [self instanceMethodForSelector:@selector(drawRect:)]; } - (id)init { return [self initWithFrame:CGRectZero]; } - (id)initWithFrame:(CGRect)theFrame { if ((self=[super init])) { _implementsDrawRect = [[self class] _instanceImplementsDrawRect]; _clearsContextBeforeDrawing = YES; _autoresizesSubviews = YES; _userInteractionEnabled = YES; _subviews = [[NSMutableSet alloc] init]; _gestureRecognizers = [[NSMutableSet alloc] init]; _layer = [[[[self class] layerClass] alloc] init]; _layer.delegate = self; _layer.layoutManager = [UIViewLayoutManager layoutManager]; self.contentMode = UIViewContentModeScaleToFill; self.contentScaleFactor = 0; self.frame = theFrame; self.alpha = 1; self.opaque = YES; [self setNeedsDisplay]; } return self; } - (void)dealloc { [[_subviews allObjects] makeObjectsPerformSelector:@selector(removeFromSuperview)]; _layer.layoutManager = nil; _layer.delegate = nil; [_layer removeFromSuperlayer]; [_subviews release]; [_layer release]; [_backgroundColor release]; [_gestureRecognizers release]; [super dealloc]; } - (void)_setViewController:(UIViewController *)theViewController { _viewController = theViewController; } - (UIViewController *)_viewController { return _viewController; } - (UIWindow *)window { return _superview.window; } - (UIResponder *)nextResponder { return (UIResponder *)[self _viewController] ?: (UIResponder *)_superview; } - (id)_appearanceContainer { return self.superview; } - (NSArray *)subviews { NSArray *sublayers = _layer.sublayers; NSMutableArray *subviews = [NSMutableArray arrayWithCapacity:[sublayers count]]; // This builds the results from the layer instead of just using _subviews because I want the results to match // the order that CALayer has them. It's unclear in the docs if the returned order from this method is guarenteed or not, // however several other aspects of the system (namely the hit testing) depends on this order being correct. for (CALayer *layer in sublayers) { id potentialView = [layer delegate]; if ([_subviews containsObject:potentialView]) { [subviews addObject:potentialView]; } } return subviews; } - (void)_willMoveFromWindow:(UIWindow *)fromWindow toWindow:(UIWindow *)toWindow { if (fromWindow != toWindow) { // need to manage the responder chain. apparently UIKit (at least by version 4.2) seems to make sure that if a view was first responder // and it or it's parent views are disconnected from their window, the first responder gets reset to nil. Honestly, I don't think this // was always true - but it's certainly a much better and less-crashy design. Hopefully this check here replicates the behavior properly. if ([self isFirstResponder]) { [self resignFirstResponder]; } [self _setAppearanceNeedsUpdate]; [self willMoveToWindow:toWindow]; for (UIView *subview in self.subviews) { [subview _willMoveFromWindow:fromWindow toWindow:toWindow]; } } } - (void)_didMoveToScreen { if (_implementsDrawRect && self.contentScaleFactor != self.window.screen.scale) { self.contentScaleFactor = self.window.screen.scale; } else { [self setNeedsDisplay]; } for (UIView *subview in self.subviews) { [subview _didMoveToScreen]; } } - (void)_didMoveFromWindow:(UIWindow *)fromWindow toWindow:(UIWindow *)toWindow { if (fromWindow != toWindow) { [self didMoveToWindow]; for (UIView *subview in self.subviews) { [subview _didMoveFromWindow:fromWindow toWindow:toWindow]; } } } - (BOOL)_subviewControllersNeedAppearAndDisappear { UIView *view = self; while (view) { if ([view _viewController] != nil) { return NO; } else { view = [view superview]; } } return YES; } - (void)addSubview:(UIView *)subview { NSAssert((!subview || [subview isKindOfClass:[UIView class]]), @"the subview must be a UIView"); if (subview && subview.superview != self) { UIWindow *oldWindow = subview.window; UIWindow *newWindow = self.window; subview->_needsDidAppearOrDisappear = [self _subviewControllersNeedAppearAndDisappear]; if ([subview _viewController] && subview->_needsDidAppearOrDisappear) { [[subview _viewController] viewWillAppear:NO]; } [subview _willMoveFromWindow:oldWindow toWindow:newWindow]; [subview willMoveToSuperview:self]; { [subview retain]; if (subview.superview) { [subview.layer removeFromSuperlayer]; [subview.superview->_subviews removeObject:subview]; } [subview willChangeValueForKey:@"superview"]; [_subviews addObject:subview]; subview->_superview = self; [_layer addSublayer:subview.layer]; [subview didChangeValueForKey:@"superview"]; [subview release]; } if (oldWindow.screen != newWindow.screen) { [subview _didMoveToScreen]; } [subview _didMoveFromWindow:oldWindow toWindow:newWindow]; [subview didMoveToSuperview]; [[NSNotificationCenter defaultCenter] postNotificationName:UIViewDidMoveToSuperviewNotification object:subview]; [self didAddSubview:subview]; if ([subview _viewController] && subview->_needsDidAppearOrDisappear) { [[subview _viewController] viewDidAppear:NO]; } } } - (void)insertSubview:(UIView *)subview atIndex:(NSInteger)index { [self addSubview:subview]; [_layer insertSublayer:subview.layer atIndex:index]; } - (void)insertSubview:(UIView *)subview belowSubview:(UIView *)below { [self addSubview:subview]; [_layer insertSublayer:subview.layer below:below.layer]; } - (void)insertSubview:(UIView *)subview aboveSubview:(UIView *)above { [self addSubview:subview]; [_layer insertSublayer:subview.layer above:above.layer]; } - (void)bringSubviewToFront:(UIView *)subview { if (subview.superview == self) { [_layer insertSublayer:subview.layer above:[[_layer sublayers] lastObject]]; } } - (void)sendSubviewToBack:(UIView *)subview { if (subview.superview == self) { [_layer insertSublayer:subview.layer atIndex:0]; } } - (void)removeFromSuperview { if (_superview) { [self retain]; [[UIApplication sharedApplication] _removeViewFromTouches:self]; UIWindow *oldWindow = self.window; if (_needsDidAppearOrDisappear && [self _viewController]) { [[self _viewController] viewWillDisappear:NO]; } [_superview willRemoveSubview:self]; [self _willMoveFromWindow:oldWindow toWindow:nil]; [self willMoveToSuperview:nil]; [self willChangeValueForKey:@"superview"]; [_layer removeFromSuperlayer]; [_superview->_subviews removeObject:self]; _superview = nil; [self didChangeValueForKey:@"superview"]; [self _didMoveFromWindow:oldWindow toWindow:nil]; [self didMoveToSuperview]; [[NSNotificationCenter defaultCenter] postNotificationName:UIViewDidMoveToSuperviewNotification object:self]; if (_needsDidAppearOrDisappear && [self _viewController]) { [[self _viewController] viewDidDisappear:NO]; } [self release]; } } - (void)didAddSubview:(UIView *)subview { } - (void)didMoveToSuperview { } - (void)didMoveToWindow { } - (void)willMoveToSuperview:(UIView *)newSuperview { } - (void)willMoveToWindow:(UIWindow *)newWindow { } - (void)willRemoveSubview:(UIView *)subview { } - (CGPoint)convertPoint:(CGPoint)toConvert fromView:(UIView *)fromView { // NOTE: this is a lot more complex than it needs to be - I just noticed the docs say this method requires fromView and self to // belong to the same UIWindow! arg! leaving this for now because, well, it's neat.. but also I'm too tired to really ponder // all the implications of a change to something so "low level". if (fromView) { // If the screens are the same, then we know they share a common parent CALayer, so we can convert directly with the layer's // conversion method. If not, though, we need to do something a bit more complicated. if (fromView && (self.window.screen == fromView.window.screen)) { return [fromView.layer convertPoint:toConvert toLayer:self.layer]; } else { // Convert coordinate to fromView's window base coordinates. toConvert = [fromView.layer convertPoint:toConvert toLayer:fromView.window.layer]; // Now convert from fromView's window to our own window. toConvert = [fromView.window convertPoint:toConvert toWindow:self.window]; } } // Convert from our window coordinate space into our own coordinate space. return [self.window.layer convertPoint:toConvert toLayer:self.layer]; } - (CGPoint)convertPoint:(CGPoint)toConvert toView:(UIView *)toView { // NOTE: this is a lot more complex than it needs to be - I just noticed the docs say this method requires toView and self to // belong to the same UIWindow! arg! leaving this for now because, well, it's neat.. but also I'm too tired to really ponder // all the implications of a change to something so "low level". // See note in convertPoint:fromView: for some explaination about why this is done... :/ if (toView && (self.window.screen == toView.window.screen)) { return [self.layer convertPoint:toConvert toLayer:toView.layer]; } else { // Convert to our window's coordinate space. toConvert = [self.layer convertPoint:toConvert toLayer:self.window.layer]; if (toView) { // Convert from one window's coordinate space to another. toConvert = [self.window convertPoint:toConvert toWindow:toView.window]; // Convert from toView's window down to toView's coordinate space. toConvert = [toView.window.layer convertPoint:toConvert toLayer:toView.layer]; } return toConvert; } } - (CGRect)convertRect:(CGRect)toConvert fromView:(UIView *)fromView { CGPoint origin = [self convertPoint:CGPointMake(CGRectGetMinX(toConvert),CGRectGetMinY(toConvert)) fromView:fromView]; CGPoint bottom = [self convertPoint:CGPointMake(CGRectGetMaxX(toConvert),CGRectGetMaxY(toConvert)) fromView:fromView]; return CGRectMake(origin.x, origin.y, bottom.x-origin.x, bottom.y-origin.y); } - (CGRect)convertRect:(CGRect)toConvert toView:(UIView *)toView { CGPoint origin = [self convertPoint:CGPointMake(CGRectGetMinX(toConvert),CGRectGetMinY(toConvert)) toView:toView]; CGPoint bottom = [self convertPoint:CGPointMake(CGRectGetMaxX(toConvert),CGRectGetMaxY(toConvert)) toView:toView]; return CGRectMake(origin.x, origin.y, bottom.x-origin.x, bottom.y-origin.y); } - (void)sizeToFit { CGRect frame = self.frame; frame.size = [self sizeThatFits:frame.size]; self.frame = frame; } - (CGSize)sizeThatFits:(CGSize)size { return size; } - (UIView *)viewWithTag:(NSInteger)tagToFind { UIView *foundView = nil; if (self.tag == tagToFind) { foundView = self; } else { for (UIView *view in [self.subviews reverseObjectEnumerator]) { foundView = [view viewWithTag:tagToFind]; if (foundView) break; } } return foundView; } - (BOOL)isDescendantOfView:(UIView *)view { if (view) { UIView *testView = self; while (testView) { if (testView == view) { return YES; } else { testView = testView.superview; } } } return NO; } - (void)setNeedsDisplay { [_layer setNeedsDisplay]; } - (void)setNeedsDisplayInRect:(CGRect)invalidRect { [_layer setNeedsDisplayInRect:invalidRect]; } - (void)drawRect:(CGRect)rect { } - (void)displayLayer:(CALayer *)theLayer { // Okay, this is some crazy stuff right here. Basically, the real UIKit avoids creating any contents for its layer if there's no drawRect: // specified in the UIView's subview. This nicely prevents a ton of useless memory usage and likley improves performance a lot on iPhone. // It took great pains to discover this trick and I think I'm doing this right. By having this method empty here, it means that it overrides // the layer's normal display method and instead does nothing which results in the layer not making a backing store and wasting memory. // Here's how CALayer appears to work: // 1- something call's the layer's -display method. // 2- arrive in CALayer's display: method. // 2a- if delegate implements displayLayer:, call that. // 2b- if delegate doesn't implement displayLayer:, CALayer creates a buffer and a context and passes that to drawInContext: // 3- arrive in CALayer's drawInContext: method. // 3a- if delegate implements drawLayer:inContext:, call that and pass it the context. // 3b- otherwise, does nothing // So, what this all means is that to avoid causing the CALayer to create a context and use up memory, our delegate has to lie to CALayer // about if it implements displayLayer: or not. If we say it does, we short circuit the layer's buffer creation process (since it assumes // we are going to be setting it's contents property ourselves). So, that's what we do in the override of respondsToSelector: below. // backgroundColor is influenced by all this as well. If drawRect: is defined, we draw it directly in the context so that blending is all // pretty and stuff. If it isn't, though, we still want to support it. What the real UIKit does is it sets the layer's backgroundColor // iff drawRect: isn't specified. Otherwise it manages it itself. Again, this is for performance reasons. Rather than having to store a // whole bitmap the size of view just to hold the backgroundColor, this allows a lot of views to simply act as containers and not waste // a bunch of unnecessary memory in those cases - but you can still use background colors because CALayer manages that effeciently. // note that the last time I checked this, the layer's background color was being set immediately on call to -setBackgroundColor: // when there was no -drawRect: implementation, but I needed to change this to work around issues with pattern image colors in HiDPI. _layer.backgroundColor = [self.backgroundColor _bestRepresentationForProposedScale:self.window.screen.scale].CGColor; } - (BOOL)respondsToSelector:(SEL)aSelector { // For notes about why this is done, see displayLayer: above. if (aSelector == @selector(displayLayer:)) { return !_implementsDrawRect; } else { return [super respondsToSelector:aSelector]; } } - (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx { // We only get here if the UIView subclass implements drawRect:. To do this without a drawRect: is a huge waste of memory. // See the discussion in drawLayer: above. const CGRect bounds = CGContextGetClipBoundingBox(ctx); UIGraphicsPushContext(ctx); CGContextSaveGState(ctx); if (_clearsContextBeforeDrawing) { CGContextClearRect(ctx, bounds); } if (_backgroundColor) { [_backgroundColor setFill]; CGContextFillRect(ctx,bounds); } /* NOTE: This kind of logic would seem to be ideal and result in the best font rendering when possible. The downside here is that the rendering is then inconsistent throughout the app depending on how certain views are constructed or configured. I'm not sure what to do about this. It appears to be impossible to subpixel render text drawn into a transparent layer because of course there are no pixels behind the text to use when doing the subpixel blending. If it is turned on in that case, it looks bad depending on what is ultimately composited behind it. Turning it off everywhere makes everything "equally bad," in a sense, but at least stuff doesn't jump out as obviously different. However this doesn't look very nice on OSX. iOS appears to not use any subpixel smoothing anywhere but doesn't seem to look bad when using it. There are many possibilities for why. Some I can think of are they are setting some kind of graphics context mode I just haven't found yet, the rendering engines are fundamentally different, the fonts themselves are actually different, the DPI of the devices, voodoo, or the loch ness monster. */ /* UPDATE: I've since flattened some of the main views in Twitterrific/Ostrich and so now I'd like to have subpixel turned on for the Mac, so I'm putting this code back in here. It tries to be smart about when to do it (because if it's on when it shouldn't be the results look very bad). As the note above said, this can and does result in some inconsistency with the rendering in the app depending on how things are done. Typical UIKit code is going to be lots of layers and thus text will mostly look bad with straight ports but at this point I really can't come up with a much better solution so it'll have to do. */ /* UPDATE AGAIN: So, subpixel with light text against a dark background looks kinda crap and we can't seem to figure out how to make it not-crap right now. After messing with some fonts and things, we're currently turning subpixel off again instead. I have a feeling this may go round and round forever because some people can't stand subpixel and others can't stand not having it - even when its light-on-dark. We could turn it on here and selectively disable it in Twitterrific when using the dark theme, but that seems weird, too. We'd all rather there be just one approach here and skipping smoothing at least means that the whole app is consistent (views that aren't flattened won't look any different from the flattened views in terms of text rendering, at least). Bah. */ //const BOOL shouldSmoothFonts = (_backgroundColor && (CGColorGetAlpha(_backgroundColor.CGColor) == 1)) || self.opaque; //CGContextSetShouldSmoothFonts(ctx, shouldSmoothFonts); CGContextSetShouldSmoothFonts(ctx, NO); CGContextSetShouldSubpixelPositionFonts(ctx, YES); CGContextSetShouldSubpixelQuantizeFonts(ctx, YES); [[UIColor blackColor] set]; [self drawRect:bounds]; CGContextRestoreGState(ctx); UIGraphicsPopContext(); } - (id)actionForLayer:(CALayer *)theLayer forKey:(NSString *)event { if (_animationsEnabled && [_animationGroups lastObject] && theLayer == _layer) { return [[_animationGroups lastObject] actionForView:self forKey:event] ?: (id)[NSNull null]; } else { return [NSNull null]; } } - (void)_superviewSizeDidChangeFrom:(CGSize)oldSize to:(CGSize)newSize { if (_autoresizingMask != UIViewAutoresizingNone) { CGRect frame = self.frame; const CGSize delta = CGSizeMake(newSize.width-oldSize.width, newSize.height-oldSize.height); #define hasAutoresizingFor(x) ((_autoresizingMask & (x)) == (x)) /* top + bottom + height => y = floor(y + (y / HEIGHT * delta)); height = floor(height + (height / HEIGHT * delta)) top + height => t = y + height; y = floor(y + (y / t * delta); height = floor(height + (height / t * delta); bottom + height => height = floor(height + (height / (HEIGHT - y) * delta)) top + bottom => y = floor(y + (delta / 2)) height => height = floor(height + delta) top => y = floor(y + delta) bottom => y = floor(y) */ if (hasAutoresizingFor(UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleBottomMargin)) { frame.origin.y = floorf(frame.origin.y + (frame.origin.y / oldSize.height * delta.height)); frame.size.height = floorf(frame.size.height + (frame.size.height / oldSize.height * delta.height)); } else if (hasAutoresizingFor(UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleHeight)) { const CGFloat t = frame.origin.y + frame.size.height; frame.origin.y = floorf(frame.origin.y + (frame.origin.y / t * delta.height)); frame.size.height = floorf(frame.size.height + (frame.size.height / t * delta.height)); } else if (hasAutoresizingFor(UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleHeight)) { frame.size.height = floorf(frame.size.height + (frame.size.height / (oldSize.height - frame.origin.y) * delta.height)); } else if (hasAutoresizingFor(UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleTopMargin)) { frame.origin.y = floorf(frame.origin.y + (delta.height / 2.f)); } else if (hasAutoresizingFor(UIViewAutoresizingFlexibleHeight)) { frame.size.height = floorf(frame.size.height + delta.height); } else if (hasAutoresizingFor(UIViewAutoresizingFlexibleTopMargin)) { frame.origin.y = floorf(frame.origin.y + delta.height); } else if (hasAutoresizingFor(UIViewAutoresizingFlexibleBottomMargin)) { frame.origin.y = floorf(frame.origin.y); } if (hasAutoresizingFor(UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleRightMargin)) { frame.origin.x = floorf(frame.origin.x + (frame.origin.x / oldSize.width * delta.width)); frame.size.width = floorf(frame.size.width + (frame.size.width / oldSize.width * delta.width)); } else if (hasAutoresizingFor(UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleWidth)) { const CGFloat t = frame.origin.x + frame.size.width; frame.origin.x = floorf(frame.origin.x + (frame.origin.x / t * delta.width)); frame.size.width = floorf(frame.size.width + (frame.size.width / t * delta.width)); } else if (hasAutoresizingFor(UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth)) { frame.size.width = floorf(frame.size.width + (frame.size.width / (oldSize.width - frame.origin.x) * delta.width)); } else if (hasAutoresizingFor(UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin)) { frame.origin.x = floorf(frame.origin.x + (delta.width / 2.f)); } else if (hasAutoresizingFor(UIViewAutoresizingFlexibleWidth)) { frame.size.width = floorf(frame.size.width + delta.width); } else if (hasAutoresizingFor(UIViewAutoresizingFlexibleLeftMargin)) { frame.origin.x = floorf(frame.origin.x + delta.width); } else if (hasAutoresizingFor(UIViewAutoresizingFlexibleRightMargin)) { frame.origin.x = floorf(frame.origin.x); } self.frame = frame; } } - (void)_boundsDidChangeFrom:(CGRect)oldBounds to:(CGRect)newBounds { if (!CGRectEqualToRect(oldBounds, newBounds)) { // setNeedsLayout doesn't seem like it should be necessary, however there was a rendering bug in a table in Flamingo that // went away when this was placed here. There must be some strange ordering issue with how that layout manager stuff works. // I never quite narrowed it down. This was an easy fix, if perhaps not ideal. [self setNeedsLayout]; if (!CGSizeEqualToSize(oldBounds.size, newBounds.size)) { if (_autoresizesSubviews) { for (UIView *subview in [_subviews allObjects]) { [subview _superviewSizeDidChangeFrom:oldBounds.size to:newBounds.size]; } } } } } + (NSSet *)keyPathsForValuesAffectingFrame { return [NSSet setWithObject:@"center"]; } - (CGRect)frame { return _layer.frame; } - (void)setFrame:(CGRect)newFrame { if (!CGRectEqualToRect(newFrame,_layer.frame)) { CGRect oldBounds = _layer.bounds; _layer.frame = newFrame; [self _boundsDidChangeFrom:oldBounds to:_layer.bounds]; [[NSNotificationCenter defaultCenter] postNotificationName:UIViewFrameDidChangeNotification object:self]; } } - (CGRect)bounds { return _layer.bounds; } - (void)setBounds:(CGRect)newBounds { if (!CGRectEqualToRect(newBounds,_layer.bounds)) { CGRect oldBounds = _layer.bounds; _layer.bounds = newBounds; [self _boundsDidChangeFrom:oldBounds to:newBounds]; [[NSNotificationCenter defaultCenter] postNotificationName:UIViewBoundsDidChangeNotification object:self]; } } - (CGPoint)center { return _layer.position; } - (void)setCenter:(CGPoint)newCenter { if (!CGPointEqualToPoint(newCenter,_layer.position)) { _layer.position = newCenter; } } - (CGAffineTransform)transform { return _layer.affineTransform; } - (void)setTransform:(CGAffineTransform)transform { if (!CGAffineTransformEqualToTransform(transform,_layer.affineTransform)) { _layer.affineTransform = transform; } } - (CGFloat)alpha { return _layer.opacity; } - (void)setAlpha:(CGFloat)newAlpha { if (newAlpha != _layer.opacity) { _layer.opacity = newAlpha; } } - (BOOL)isOpaque { return _layer.opaque; } - (void)setOpaque:(BOOL)newO { if (newO != _layer.opaque) { _layer.opaque = newO; } } - (void)setBackgroundColor:(UIColor *)newColor { if (_backgroundColor != newColor) { [_backgroundColor release]; _backgroundColor = [newColor retain]; self.opaque = [_backgroundColor _isOpaque]; } } - (BOOL)clipsToBounds { return _layer.masksToBounds; } - (void)setClipsToBounds:(BOOL)clips { if (clips != _layer.masksToBounds) { _layer.masksToBounds = clips; } } - (void)setContentStretch:(CGRect)rect { if (!CGRectEqualToRect(rect,_layer.contentsCenter)) { _layer.contentsCenter = rect; } } - (CGRect)contentStretch { return _layer.contentsCenter; } - (void)setContentScaleFactor:(CGFloat)scale { if (scale <= 0 && _implementsDrawRect) { scale = [UIScreen mainScreen].scale; } if (scale > 0 && scale != self.contentScaleFactor) { if ([_layer respondsToSelector:@selector(setContentsScale:)]) { [_layer setContentsScale:scale]; [self setNeedsDisplay]; } } } - (CGFloat)contentScaleFactor { return [_layer respondsToSelector:@selector(contentsScale)]? [_layer contentsScale] : 1; } - (void)setHidden:(BOOL)h { if (h != _layer.hidden) { _layer.hidden = h; [[NSNotificationCenter defaultCenter] postNotificationName:UIViewHiddenDidChangeNotification object:self]; } } - (BOOL)isHidden { return _layer.hidden; } - (void)setNeedsLayout { [_layer setNeedsLayout]; } - (void)layoutIfNeeded { [_layer layoutIfNeeded]; } - (void)layoutSubviews { } - (void)_layoutSubviews { [self _updateAppearanceIfNeeded]; [[self _viewController] viewWillLayoutSubviews]; [self layoutSubviews]; [[self _viewController] viewDidLayoutSubviews]; } - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event { return CGRectContainsPoint(self.bounds, point); } - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { if (self.hidden || !self.userInteractionEnabled || self.alpha < 0.01 || ![self pointInside:point withEvent:event]) { return nil; } else { for (UIView *subview in [self.subviews reverseObjectEnumerator]) { UIView *hitView = [subview hitTest:[subview convertPoint:point fromView:self] withEvent:event]; if (hitView) { return hitView; } } return self; } } - (void)setContentMode:(UIViewContentMode)mode { if (mode != _contentMode) { _contentMode = mode; switch(_contentMode) { case UIViewContentModeScaleToFill: _layer.contentsGravity = kCAGravityResize; _layer.needsDisplayOnBoundsChange = NO; break; case UIViewContentModeScaleAspectFit: _layer.contentsGravity = kCAGravityResizeAspect; _layer.needsDisplayOnBoundsChange = NO; break; case UIViewContentModeScaleAspectFill: _layer.contentsGravity = kCAGravityResizeAspectFill; _layer.needsDisplayOnBoundsChange = NO; break; case UIViewContentModeRedraw: _layer.needsDisplayOnBoundsChange = YES; break; case UIViewContentModeCenter: _layer.contentsGravity = kCAGravityCenter; _layer.needsDisplayOnBoundsChange = NO; break; case UIViewContentModeTop: _layer.contentsGravity = kCAGravityTop; _layer.needsDisplayOnBoundsChange = NO; break; case UIViewContentModeBottom: _layer.contentsGravity = kCAGravityBottom; _layer.needsDisplayOnBoundsChange = NO; break; case UIViewContentModeLeft: _layer.contentsGravity = kCAGravityLeft; _layer.needsDisplayOnBoundsChange = NO; break; case UIViewContentModeRight: _layer.contentsGravity = kCAGravityRight; _layer.needsDisplayOnBoundsChange = NO; break; case UIViewContentModeTopLeft: _layer.contentsGravity = kCAGravityTopLeft; _layer.needsDisplayOnBoundsChange = NO; break; case UIViewContentModeTopRight: _layer.contentsGravity = kCAGravityTopRight; _layer.needsDisplayOnBoundsChange = NO; break; case UIViewContentModeBottomLeft: _layer.contentsGravity = kCAGravityBottomLeft; _layer.needsDisplayOnBoundsChange = NO; break; case UIViewContentModeBottomRight: _layer.contentsGravity = kCAGravityBottomRight; _layer.needsDisplayOnBoundsChange = NO; break; } } } - (void)addGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer { if (![_gestureRecognizers containsObject:gestureRecognizer]) { [gestureRecognizer.view removeGestureRecognizer:gestureRecognizer]; [_gestureRecognizers addObject:gestureRecognizer]; [gestureRecognizer _setView:self]; } } - (void)removeGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer { if ([_gestureRecognizers containsObject:gestureRecognizer]) { [gestureRecognizer _setView:nil]; [_gestureRecognizers removeObject:gestureRecognizer]; } } - (void)setGestureRecognizers:(NSArray *)newRecognizers { for (UIGestureRecognizer *gesture in [_gestureRecognizers allObjects]) { [self removeGestureRecognizer:gesture]; } for (UIGestureRecognizer *gesture in newRecognizers) { [self addGestureRecognizer:gesture]; } } - (NSArray *)gestureRecognizers { return [_gestureRecognizers allObjects]; } + (void)animateWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion { const BOOL ignoreInteractionEvents = !((options & UIViewAnimationOptionAllowUserInteraction) == UIViewAnimationOptionAllowUserInteraction); const BOOL repeatAnimation = ((options & UIViewAnimationOptionRepeat) == UIViewAnimationOptionRepeat); const BOOL autoreverseRepeat = ((options & UIViewAnimationOptionAutoreverse) == UIViewAnimationOptionAutoreverse); const BOOL beginFromCurrentState = ((options & UIViewAnimationOptionBeginFromCurrentState) == UIViewAnimationOptionBeginFromCurrentState); UIViewAnimationCurve animationCurve; if ((options & UIViewAnimationOptionCurveEaseInOut) == UIViewAnimationOptionCurveEaseInOut) { animationCurve = UIViewAnimationCurveEaseInOut; } else if ((options & UIViewAnimationOptionCurveEaseIn) == UIViewAnimationOptionCurveEaseIn) { animationCurve = UIViewAnimationCurveEaseIn; } else if ((options & UIViewAnimationOptionCurveEaseOut) == UIViewAnimationOptionCurveEaseOut) { animationCurve = UIViewAnimationCurveEaseOut; } else { animationCurve = UIViewAnimationCurveLinear; } // NOTE: As of iOS 5 this is only supposed to block interaction events for the views being animated, not the whole app. if (ignoreInteractionEvents) { [[UIApplication sharedApplication] beginIgnoringInteractionEvents]; } UIViewBlockAnimationDelegate *delegate = [[UIViewBlockAnimationDelegate alloc] init]; delegate.completion = completion; delegate.ignoreInteractionEvents = ignoreInteractionEvents; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationCurve:animationCurve]; [UIView setAnimationDelay:delay]; [UIView setAnimationDuration:duration]; [UIView setAnimationBeginsFromCurrentState:beginFromCurrentState]; [UIView setAnimationDelegate:delegate]; // this is retained here [UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:)]; [UIView setAnimationRepeatCount:(repeatAnimation? FLT_MAX : 0)]; [UIView setAnimationRepeatAutoreverses:autoreverseRepeat]; animations(); [UIView commitAnimations]; [delegate release]; } + (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion { [self animateWithDuration:duration delay:0 options:UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionTransitionNone animations:animations completion:completion]; } + (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations { [self animateWithDuration:duration animations:animations completion:NULL]; } + (void)transitionWithView:(UIView *)view duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completio { } + (void)transitionFromView:(UIView *)fromView toView:(UIView *)toView duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options completion:(void (^)(BOOL finished))completion { } + (void)beginAnimations:(NSString *)animationID context:(void *)context { [_animationGroups addObject:[UIViewAnimationGroup animationGroupWithName:animationID context:context]]; } + (void)commitAnimations { if ([_animationGroups count] > 0) { [[_animationGroups lastObject] commit]; [_animationGroups removeLastObject]; } } + (void)setAnimationBeginsFromCurrentState:(BOOL)beginFromCurrentState { [[_animationGroups lastObject] setAnimationBeginsFromCurrentState:beginFromCurrentState]; } + (void)setAnimationCurve:(UIViewAnimationCurve)curve { [[_animationGroups lastObject] setAnimationCurve:curve]; } + (void)setAnimationDelay:(NSTimeInterval)delay { [[_animationGroups lastObject] setAnimationDelay:delay]; } + (void)setAnimationDelegate:(id)delegate { [[_animationGroups lastObject] setAnimationDelegate:delegate]; } + (void)setAnimationDidStopSelector:(SEL)selector { [[_animationGroups lastObject] setAnimationDidStopSelector:selector]; } + (void)setAnimationDuration:(NSTimeInterval)duration { [[_animationGroups lastObject] setAnimationDuration:duration]; } + (void)setAnimationRepeatAutoreverses:(BOOL)repeatAutoreverses { [[_animationGroups lastObject] setAnimationRepeatAutoreverses:repeatAutoreverses]; } + (void)setAnimationRepeatCount:(float)repeatCount { [[_animationGroups lastObject] setAnimationRepeatCount:repeatCount]; } + (void)setAnimationWillStartSelector:(SEL)selector { [[_animationGroups lastObject] setAnimationWillStartSelector:selector]; } + (void)setAnimationTransition:(UIViewAnimationTransition)transition forView:(UIView *)view cache:(BOOL)cache { [[_animationGroups lastObject] setAnimationTransition:transition forView:view cache:cache]; } + (BOOL)areAnimationsEnabled { return _animationsEnabled; } + (void)setAnimationsEnabled:(BOOL)enabled { _animationsEnabled = enabled; } - (NSString *)description { return [NSString stringWithFormat:@"<%@: %p; frame = %@; hidden = %@; layer = %@>", [self className], self, NSStringFromCGRect(self.frame), (self.hidden ? @"YES" : @"NO"), self.layer]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIViewAdapter.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIScrollView.h" @class NSView, UINSClipView; @interface UIViewAdapter : UIScrollView { @private UINSClipView *_clipView; NSView *_view; } - (id)initWithNSView:(NSView *)aNSView; @property (nonatomic, strong) NSView *NSView; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIViewAdapter.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIViewAdapter.h" #import "UINSClipView.h" #import "UIWindow.h" #import "UIKitView.h" #import "UIScrollView+UIPrivate.h" #import "UIScreen+UIPrivate.h" #import "UIScreenAppKitIntegration.h" #import "UIView+UIPrivate.h" #import "UIApplication.h" #import #import #import #import @implementation UIViewAdapter @synthesize NSView=_view; #pragma mark - #pragma mark Initialization - (id)initWithFrame:(CGRect)frame { if ((self=[super initWithFrame:frame])) { _clipView = [[UINSClipView alloc] initWithFrame:NSMakeRect(0,0,frame.size.width,frame.size.height) parentView:self]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_hierarchyMayHaveChangedNotification:) name:UIViewHiddenDidChangeNotification object:nil]; } return self; } - (id)initWithNSView:(NSView *)aNSView { const NSSize viewFrameSize = aNSView? [aNSView frame].size : NSZeroSize; if ((self=[self initWithFrame:CGRectMake(0,0,viewFrameSize.width,viewFrameSize.height)])) { self.NSView = aNSView; } return self; } - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self name:UIViewHiddenDidChangeNotification object:nil]; [_view release]; [_clipView release]; [super dealloc]; } #pragma mark - #pragma mark Magic - (void)_addNSView { [_clipView scrollToPoint:NSPointFromCGPoint(self.contentOffset)]; [[self.window.screen UIKitView] addSubview:_clipView]; // all of these notifications are hacks to detect when views or superviews of this view move or change in ways that require // the actual NSView to get updated. it's not pretty, but I cannot come up with a better way at this point. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_updateScrollViewAndFlashScrollbars) name:NSViewBoundsDidChangeNotification object:_clipView]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_hierarchyMayHaveChangedNotification:) name:UIViewFrameDidChangeNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_hierarchyMayHaveChangedNotification:) name:UIViewBoundsDidChangeNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_hierarchyMayHaveChangedNotification:) name:UIViewDidMoveToSuperviewNotification object:nil]; } - (void)_removeNSView { [[NSNotificationCenter defaultCenter] removeObserver:self name:NSViewBoundsDidChangeNotification object:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self name:UIViewFrameDidChangeNotification object:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self name:UIViewBoundsDidChangeNotification object:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self name:UIViewDidMoveToSuperviewNotification object:nil]; [_clipView removeFromSuperview]; } - (void)_updateLayers { [CATransaction begin]; [CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions]; CALayer *layer = self.layer; CALayer *clipLayer = [_clipView layer]; // setting these here because I've had bad experiences with NSView changing some layer properties out from under me. clipLayer.geometryFlipped = YES; // always make sure it's at the very bottom [layer insertSublayer:clipLayer atIndex:0]; // don't resize unless we have to if (!CGRectEqualToRect(clipLayer.frame, layer.bounds)) { clipLayer.frame = layer.bounds; } [CATransaction commit]; } - (void)_updateScrollView { const NSRect docRect = [_clipView documentRect]; self.contentSize = CGSizeMake(docRect.size.width+docRect.origin.x, docRect.size.height+docRect.origin.y); self.contentOffset = NSPointToCGPoint([_clipView bounds].origin); } - (void)_updateScrollViewAndFlashScrollbars { [self _updateScrollView]; [self _quickFlashScrollIndicators]; } - (BOOL)_NSViewShouldBeVisible { if (_view && self.window) { UIView *v = self; while (v) { if (v.hidden) { return NO; } v = [v superview]; } return YES; } else { return NO; } } - (void)_updateNSViews { if ([self _NSViewShouldBeVisible]) { if ([_clipView superview] != [self.window.screen UIKitView]) { [self _addNSView]; } // translate the adapter's frame to the real NSWindow's coordinate space so that the NSView lines up correctly UIWindow *window = self.window; const CGRect windowRect = [window convertRect:self.frame fromView:self.superview]; const CGRect screenRect = [window convertRect:windowRect toWindow:nil]; NSRect desiredFrame = NSRectFromCGRect(screenRect); [_clipView setFrame:desiredFrame]; [self _updateScrollView]; [self _updateLayers]; } else { [self _removeNSView]; } } - (void)_hierarchyMayHaveChangedNotification:(NSNotification *)note { if ([self isDescendantOfView:[note object]]) { [self _updateNSViews]; } } #pragma mark - #pragma mark UIView Overrides - (void)layoutSubviews { [super layoutSubviews]; [self _updateLayers]; } - (void)didMoveToWindow { [super didMoveToWindow]; [self _updateNSViews]; } #pragma mark - #pragma mark Properties - (void)setNSView:(NSView *)aNSView { if (aNSView != _view) { [self resignFirstResponder]; [self _removeNSView]; [_view release]; _view = [aNSView retain]; [_clipView setDocumentView:_view]; [self _updateNSViews]; } } #pragma mark - #pragma mark UIScrollView Overrides - (void)setContentOffset:(CGPoint)theOffset animated:(BOOL)animated { // rounding to avoid fuzzy images from subpixel alignment issues theOffset.x = roundf(theOffset.x); theOffset.y = roundf(theOffset.y); [super setContentOffset:theOffset animated:animated]; [_clipView scrollToPoint:[_clipView constrainScrollPoint:NSPointFromCGPoint(theOffset)]]; } #pragma mark - #pragma mark UIResponder Overrides - (BOOL)canBecomeFirstResponder { return [self _NSViewShouldBeVisible]? [_view acceptsFirstResponder] : NO; } - (BOOL)becomeFirstResponder { [self _updateNSViews]; if ([super becomeFirstResponder]) { [[_view window] makeFirstResponder:_view]; return YES; } else { return NO; } } - (BOOL)resignFirstResponder { [self _updateNSViews]; const BOOL didResign = [super resignFirstResponder]; if (didResign && [[_view window] firstResponder] == _view) { [[_view window] makeFirstResponder:[self.window.screen UIKitView]]; } return didResign; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIViewAnimationGroup.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIView.h" @interface UIViewAnimationGroup : NSObject { @private NSString *_name; void *_context; NSUInteger _waitingAnimations; BOOL _didSendStartMessage; NSTimeInterval _animationDelay; NSTimeInterval _animationDuration; UIViewAnimationCurve _animationCurve; id _animationDelegate; SEL _animationDidStopSelector; SEL _animationWillStartSelector; BOOL _animationBeginsFromCurrentState; BOOL _animationRepeatAutoreverses; float _animationRepeatCount; CFTimeInterval _animationBeginTime; CALayer *_transitionLayer; UIViewAnimationTransition _transitionType; BOOL _transitionShouldCache; NSMutableSet *_animatingViews; } + (id)animationGroupWithName:(NSString *)theName context:(void *)theContext; - (id)actionForView:(UIView *)view forKey:(NSString *)keyPath; - (void)setAnimationBeginsFromCurrentState:(BOOL)beginFromCurrentState; - (void)setAnimationCurve:(UIViewAnimationCurve)curve; - (void)setAnimationDelay:(NSTimeInterval)delay; - (void)setAnimationDelegate:(id)delegate; // retained! (also true of the real UIKit) - (void)setAnimationDidStopSelector:(SEL)selector; - (void)setAnimationDuration:(NSTimeInterval)duration; - (void)setAnimationRepeatAutoreverses:(BOOL)repeatAutoreverses; - (void)setAnimationRepeatCount:(float)repeatCount; - (void)setAnimationTransition:(UIViewAnimationTransition)transition forView:(UIView *)view cache:(BOOL)cache; - (void)setAnimationWillStartSelector:(SEL)selector; - (void)commit; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIViewAnimationGroup.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIViewAnimationGroup.h" #import #import "UIColor.h" static CAMediaTimingFunction *CAMediaTimingFunctionFromUIViewAnimationCurve(UIViewAnimationCurve curve) { switch (curve) { case UIViewAnimationCurveEaseInOut: return [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; case UIViewAnimationCurveEaseIn: return [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]; case UIViewAnimationCurveEaseOut: return [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; case UIViewAnimationCurveLinear: return [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; } return nil; } @implementation UIViewAnimationGroup - (id)initWithGroupName:(NSString *)theName context:(void *)theContext { if ((self=[super init])) { _name = [theName copy]; _context = theContext; _waitingAnimations = 1; _animationDuration = 0.2; _animationCurve = UIViewAnimationCurveEaseInOut; _animationBeginsFromCurrentState = NO; _animationRepeatAutoreverses = NO; _animationRepeatCount = 0; _animationBeginTime = CACurrentMediaTime(); _animatingViews = [[NSMutableSet alloc] initWithCapacity:0]; } return self; } - (void)dealloc { [_name release]; [_animationDelegate release]; [_animatingViews release]; [super dealloc]; } + (id)animationGroupWithName:(NSString *)theName context:(void *)theContext { return [[[self alloc] initWithGroupName:theName context:theContext] autorelease]; } - (void)notifyAnimationsDidStopIfNeededUsingStatus:(BOOL)animationsDidFinish { if (_waitingAnimations == 0) { if ([_animationDelegate respondsToSelector:_animationDidStopSelector]) { NSMethodSignature *signature = [_animationDelegate methodSignatureForSelector:_animationDidStopSelector]; NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; [invocation setSelector:_animationDidStopSelector]; NSInteger remaining = [signature numberOfArguments] - 2; NSNumber *finishedArgument = [NSNumber numberWithBool:animationsDidFinish]; if (remaining > 0) { [invocation setArgument:&_name atIndex:2]; remaining--; } if (remaining > 0) { [invocation setArgument:&finishedArgument atIndex:3]; remaining--; } if (remaining > 0) { [invocation setArgument:&_context atIndex:4]; } [invocation invokeWithTarget:_animationDelegate]; } [_animatingViews removeAllObjects]; } } - (void)animationDidStart:(CAAnimation *)theAnimation { if (!_didSendStartMessage) { if ([_animationDelegate respondsToSelector:_animationWillStartSelector]) { NSMethodSignature *signature = [_animationDelegate methodSignatureForSelector:_animationWillStartSelector]; NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; [invocation setSelector:_animationWillStartSelector]; NSInteger remaining = [signature numberOfArguments] - 2; if (remaining > 0) { [invocation setArgument:&_name atIndex:2]; remaining--; } if (remaining > 0) { [invocation setArgument:&_context atIndex:3]; } [invocation invokeWithTarget:_animationDelegate]; } _didSendStartMessage = YES; } } - (void)animationDidStop:(CAAnimation *)theAnimation finished:(BOOL)flag { _waitingAnimations--; [self notifyAnimationsDidStopIfNeededUsingStatus:flag]; } - (CAAnimation *)addAnimation:(CAAnimation *)animation { animation.timingFunction = CAMediaTimingFunctionFromUIViewAnimationCurve(_animationCurve); animation.duration = _animationDuration; animation.beginTime = _animationBeginTime + _animationDelay; animation.repeatCount = _animationRepeatCount; animation.autoreverses = _animationRepeatAutoreverses; animation.fillMode = kCAFillModeBackwards; animation.delegate = self; animation.removedOnCompletion = YES; _waitingAnimations++; return animation; } - (id)actionForView:(UIView *)view forKey:(NSString *)keyPath { [_animatingViews addObject:view]; CALayer *layer = view.layer; CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:keyPath]; animation.fromValue = _animationBeginsFromCurrentState? [layer.presentationLayer valueForKey:keyPath] : [layer valueForKey:keyPath]; return [self addAnimation:animation]; } - (void)setAnimationBeginsFromCurrentState:(BOOL)beginFromCurrentState { _animationBeginsFromCurrentState = beginFromCurrentState; } - (void)setAnimationCurve:(UIViewAnimationCurve)curve { _animationCurve = curve; } - (void)setAnimationDelay:(NSTimeInterval)delay { _animationDelay = delay; } - (void)setAnimationDelegate:(id)delegate { if (delegate != _animationDelegate) { [_animationDelegate release]; _animationDelegate = [delegate retain]; } } - (void)setAnimationDidStopSelector:(SEL)selector { _animationDidStopSelector = selector; } - (void)setAnimationDuration:(NSTimeInterval)newDuration { _animationDuration = newDuration; } - (void)setAnimationRepeatAutoreverses:(BOOL)repeatAutoreverses { _animationRepeatAutoreverses = repeatAutoreverses; } - (void)setAnimationRepeatCount:(float)repeatCount { _animationRepeatCount = repeatCount; } - (void)setAnimationTransition:(UIViewAnimationTransition)transition forView:(UIView *)view cache:(BOOL)cache { _transitionLayer = view.layer; _transitionType = transition; _transitionShouldCache = cache; } - (void)setAnimationWillStartSelector:(SEL)selector { _animationWillStartSelector = selector; } - (void)commit { if (_transitionLayer) { CATransition *trans = [CATransition animation]; trans.type = kCATransitionMoveIn; switch (_transitionType) { case UIViewAnimationTransitionNone: trans.subtype = nil; break; case UIViewAnimationTransitionCurlUp: trans.subtype = kCATransitionFromTop; break; case UIViewAnimationTransitionCurlDown: trans.subtype = kCATransitionFromBottom; break; case UIViewAnimationTransitionFlipFromLeft: trans.subtype = kCATransitionFromLeft; break; case UIViewAnimationTransitionFlipFromRight: trans.subtype = kCATransitionFromRight; break; } [_transitionLayer addAnimation:[self addAnimation:trans] forKey:kCATransition]; } _waitingAnimations--; [self notifyAnimationsDidStopIfNeededUsingStatus:YES]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIViewBlockAnimationDelegate.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @interface UIViewBlockAnimationDelegate : NSObject { void (^_completion)(BOOL finished); BOOL _ignoreInteractionEvents; } @property (nonatomic, copy) void (^completion)(BOOL finished); @property (nonatomic, assign) BOOL ignoreInteractionEvents; - (void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIViewBlockAnimationDelegate.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIViewBlockAnimationDelegate.h" #import "UIApplication.h" @implementation UIViewBlockAnimationDelegate @synthesize completion=_completion, ignoreInteractionEvents=_ignoreInteractionEvents; - (void)dealloc { [_completion release]; [super dealloc]; } - (void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished { if (_completion) { _completion([finished boolValue]); } if (_ignoreInteractionEvents) { [[UIApplication sharedApplication] endIgnoringInteractionEvents]; } } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIViewController+UIPrivate.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIViewController.h" @interface UIViewController (UIPrivate) - (void)_setParentViewController:(UIViewController *)controller; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIViewController.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIResponder.h" #import "UIApplication.h" #import "UISearchDisplayController.h" #import "UITabBarItem.h" @class UITabBarController; typedef enum { UIModalPresentationFullScreen = 0, UIModalPresentationPageSheet, UIModalPresentationFormSheet, UIModalPresentationCurrentContext, } UIModalPresentationStyle; typedef enum { UIModalTransitionStyleCoverVertical = 0, UIModalTransitionStyleFlipHorizontal, UIModalTransitionStyleCrossDissolve, UIModalTransitionStylePartialCurl, } UIModalTransitionStyle; @class UINavigationItem, UINavigationController, UIBarButtonItem, UISplitViewController; @interface UIViewController : UIResponder { @private UIView *_view; BOOL _wantsFullScreenLayout; NSString *_title; CGSize _contentSizeForViewInPopover; BOOL _modalInPopover; UINavigationItem *_navigationItem; NSArray *_toolbarItems; UIModalPresentationStyle _modalPresentationStyle; BOOL _editing; BOOL _hidesBottomBarWhenPushed; UIViewController *_parentViewController; UIViewController *_modalViewController; UISearchDisplayController *_searchDisplayController; UIModalTransitionStyle _modalTransitionStyle; UITabBarItem *_tabBarItem; UITabBarController *_tabBarController; } - (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle; // won't load a nib no matter what you do! - (BOOL)isViewLoaded; - (void)loadView; - (void)viewDidLoad; - (void)viewDidUnload; - (void)viewWillAppear:(BOOL)animated; - (void)viewDidAppear:(BOOL)animated; - (void)viewWillDisappear:(BOOL)animated; - (void)viewDidDisappear:(BOOL)animated; - (void)viewWillLayoutSubviews; - (void)viewDidLayoutSubviews; - (void)presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated; // works, but not exactly correctly. - (void)dismissModalViewControllerAnimated:(BOOL)animated; // see comments in dismissModalViewController - (void)didReceiveMemoryWarning; // doesn't do anything and is never called... - (void)setToolbarItems:(NSArray *)toolbarItems animated:(BOOL)animated; - (void)setEditing:(BOOL)editing animated:(BOOL)animated; - (UIBarButtonItem *)editButtonItem; // not implemented - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation; - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration; - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration; - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation; @property (nonatomic, readonly, copy) NSString *nibName; // always returns nil @property (nonatomic, readonly, strong) NSBundle *nibBundle; // always returns nil @property (nonatomic, strong) UIView *view; @property (nonatomic, assign) BOOL wantsFullScreenLayout; // doesn't do anything right now @property (nonatomic, copy) NSString *title; @property (nonatomic, readonly) UIInterfaceOrientation interfaceOrientation; // always returns UIInterfaceOrientationLandscapeLeft @property (nonatomic, readonly, strong) UINavigationItem *navigationItem; @property (nonatomic, strong) NSArray *toolbarItems; @property (nonatomic, getter=isEditing) BOOL editing; @property (nonatomic) BOOL hidesBottomBarWhenPushed; @property (nonatomic, readwrite) CGSize contentSizeForViewInPopover; @property (nonatomic,readwrite,getter=isModalInPopover) BOOL modalInPopover; @property (nonatomic, readonly) UIViewController *modalViewController; @property (nonatomic, assign) UIModalPresentationStyle modalPresentationStyle; @property (nonatomic, assign) UIModalTransitionStyle modalTransitionStyle; // not used right now @property (nonatomic, readonly) UIViewController *parentViewController; @property (nonatomic, readonly, strong) UINavigationController *navigationController; @property (nonatomic, readonly, strong) UISplitViewController *splitViewController; @property (nonatomic, readonly, strong) UISearchDisplayController *searchDisplayController; // stub // stubs @property (nonatomic, strong) UITabBarItem *tabBarItem; @property (nonatomic, readonly, strong) UITabBarController *tabBarController; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIViewController.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIViewController.h" #import "UIView+UIPrivate.h" #import "UIScreen.h" #import "UIWindow.h" #import "UIScreen.h" #import "UINavigationItem.h" #import "UIBarButtonItem.h" #import "UINavigationController.h" #import "UISplitViewController.h" #import "UIToolbar.h" #import "UIScreen.h" #import "UITabBarController.h" @implementation UIViewController @synthesize view=_view, wantsFullScreenLayout=_wantsFullScreenLayout, title=_title, contentSizeForViewInPopover=_contentSizeForViewInPopover; @synthesize modalInPopover=_modalInPopover, toolbarItems=_toolbarItems, modalPresentationStyle=_modalPresentationStyle, editing=_editing; @synthesize modalViewController=_modalViewController, parentViewController=_parentViewController; @synthesize modalTransitionStyle=_modalTransitionStyle, hidesBottomBarWhenPushed=_hidesBottomBarWhenPushed; @synthesize searchDisplayController=_searchDisplayController, tabBarItem=_tabBarItem, tabBarController=_tabBarController; - (id)init { return [self initWithNibName:nil bundle:nil]; } - (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle { if ((self=[super init])) { _contentSizeForViewInPopover = CGSizeMake(320,1100); _hidesBottomBarWhenPushed = NO; } return self; } - (void)dealloc { [_view _setViewController:nil]; [_modalViewController release]; [_navigationItem release]; [_title release]; [_view release]; [super dealloc]; } - (NSString *)nibName { return nil; } - (NSBundle *)nibBundle { return nil; } - (UIResponder *)nextResponder { return _view.superview; } - (BOOL)isViewLoaded { return (_view != nil); } - (UIView *)view { if ([self isViewLoaded]) { return _view; } else { [self loadView]; [self viewDidLoad]; return _view; } } - (void)setView:(UIView *)aView { if (aView != _view) { [_view _setViewController:nil]; [_view release]; _view = [aView retain]; [_view _setViewController:self]; } } - (void)loadView { self.view = [[[UIView alloc] initWithFrame:CGRectMake(0,0,320,480)] autorelease]; } - (void)viewDidLoad { } - (void)viewDidUnload { } - (void)didReceiveMemoryWarning { } - (void)viewWillAppear:(BOOL)animated { } - (void)viewDidAppear:(BOOL)animated { } - (void)viewWillDisappear:(BOOL)animated { } - (void)viewDidDisappear:(BOOL)animated { } - (void)viewWillLayoutSubviews { } - (void)viewDidLayoutSubviews { } - (UIInterfaceOrientation)interfaceOrientation { return (UIInterfaceOrientation)UIDeviceOrientationPortrait; } - (UINavigationItem *)navigationItem { if (!_navigationItem) { _navigationItem = [[UINavigationItem alloc] initWithTitle:self.title]; } return _navigationItem; } - (void)_setParentViewController:(UIViewController *)parentController { _parentViewController = parentController; } - (void)setToolbarItems:(NSArray *)theToolbarItems animated:(BOOL)animated { if (_toolbarItems != theToolbarItems) { [_toolbarItems release]; _toolbarItems = [theToolbarItems retain]; [self.navigationController.toolbar setItems:_toolbarItems animated:animated]; } } - (void)setToolbarItems:(NSArray *)theToolbarItems { [self setToolbarItems:theToolbarItems animated:NO]; } - (void)setEditing:(BOOL)editing animated:(BOOL)animated { _editing = editing; } - (void)setEditing:(BOOL)editing { [self setEditing:editing animated:NO]; } - (UIBarButtonItem *)editButtonItem { // this should really return a fancy bar button item that toggles between edit/done and sends setEditing:animated: messages to this controller return nil; } - (void)presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated { if (!_modalViewController && _modalViewController != self) { _modalViewController = [modalViewController retain]; [_modalViewController _setParentViewController:self]; UIWindow *window = self.view.window; UIView *selfView = self.view; UIView *newView = _modalViewController.view; newView.autoresizingMask = selfView.autoresizingMask; newView.frame = _wantsFullScreenLayout? window.screen.bounds : window.screen.applicationFrame; [window addSubview:newView]; [_modalViewController viewWillAppear:animated]; [self viewWillDisappear:animated]; selfView.hidden = YES; // I think the real one may actually remove it, which would mean needing to remember the superview, I guess? Not sure... [self viewDidDisappear:animated]; [_modalViewController viewDidAppear:animated]; } } - (void)dismissModalViewControllerAnimated:(BOOL)animated { // NOTE: This is not implemented entirely correctly - the actual dismissModalViewController is somewhat subtle. // There is supposed to be a stack of modal view controllers that dismiss in a specific way,e tc. // The whole system of related view controllers is not really right - not just with modals, but everything else like // navigationController, too, which is supposed to return the nearest nav controller down the chain and it doesn't right now. if (_modalViewController) { // if the modalViewController being dismissed has a modalViewController of its own, then we need to go dismiss that, too. // otherwise things can be left hanging around. if (_modalViewController.modalViewController) { [_modalViewController dismissModalViewControllerAnimated:animated]; } self.view.hidden = NO; [self viewWillAppear:animated]; [_modalViewController.view removeFromSuperview]; [_modalViewController _setParentViewController:nil]; _modalViewController = nil; [self viewDidAppear:animated]; } else { [self.parentViewController dismissModalViewControllerAnimated:animated]; } } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceOrientationPortrait); } - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { } - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration { } - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { } - (id)_nearestParentViewControllerThatIsKindOf:(Class)c { UIViewController *controller = _parentViewController; while (controller && ![controller isKindOfClass:c]) { controller = [controller parentViewController]; } return controller; } - (UINavigationController *)navigationController { return [self _nearestParentViewControllerThatIsKindOf:[UINavigationController class]]; } - (UISplitViewController *)splitViewController { return [self _nearestParentViewControllerThatIsKindOf:[UISplitViewController class]]; } - (NSString *)description { return [NSString stringWithFormat:@"<%@: %p; title = %@; view = %@>", [self className], self, self.title, self.view]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIViewLayoutManager.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import @interface UIViewLayoutManager : NSObject + (UIViewLayoutManager *)layoutManager; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIViewLayoutManager.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIViewLayoutManager.h" #import #import "UIView+UIPrivate.h" static UIViewLayoutManager *theLayoutManager = nil; @implementation UIViewLayoutManager + (void)initialize { if (self == [UIViewLayoutManager class]) { theLayoutManager = [[self alloc] init]; } } + (UIViewLayoutManager *)layoutManager { return theLayoutManager; } - (void)layoutSublayersOfLayer:(CALayer *)theLayer { [[theLayer delegate] _layoutSubviews]; } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIWebView.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIView.h" #import "UIDataDetectors.h" enum { UIWebViewNavigationTypeLinkClicked, UIWebViewNavigationTypeFormSubmitted, UIWebViewNavigationTypeBackForward, UIWebViewNavigationTypeReload, UIWebViewNavigationTypeFormResubmitted, UIWebViewNavigationTypeOther }; typedef NSUInteger UIWebViewNavigationType; @class UIWebView, UIViewAdapter, WebView; @protocol UIWebViewDelegate @optional - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType; - (void)webView:(UIWebView *)aWebView didFailLoadWithError:(NSError *)error; - (void)webViewDidFinishLoad:(UIWebView *)webView; @end @interface UIWebView : UIView { @private __unsafe_unretained id _delegate; NSURLRequest *_request; UIDataDetectorTypes _dataDetectorTypes; WebView *_webView; UIViewAdapter *_webViewAdapter; BOOL _scalesPageToFit; struct { unsigned shouldStartLoadWithRequest : 1; unsigned didFailLoadWithError : 1; unsigned didFinishLoad : 1; } _delegateHas; } - (void)loadHTMLString:(NSString *)string baseURL:(NSURL *)baseURL; - (void)loadRequest:(NSURLRequest *)request; - (void)stopLoading; - (void)reload; - (void)goBack; - (void)goForward; - (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script; @property (nonatomic, assign) id delegate; @property (nonatomic, readonly, getter=isLoading) BOOL loading; @property (nonatomic, readonly, getter=canGoBack) BOOL canGoBack; @property (nonatomic, readonly, getter=canGoForward) BOOL canGoForward; @property (nonatomic, assign) BOOL scalesPageToFit; // not implemented @property (nonatomic, readonly, strong) NSURLRequest *request; @property (nonatomic) UIDataDetectorTypes dataDetectorTypes; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIWebView.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIWebView.h" #import "UIViewAdapter.h" #import @implementation UIWebView @synthesize request=_request, delegate=_delegate, dataDetectorTypes=_dataDetectorTypes, scalesPageToFit=_scalesPageToFit; - (id)initWithFrame:(CGRect)frame { if ((self=[super initWithFrame:frame])) { _scalesPageToFit = NO; _webView = [(WebView *)[WebView alloc] initWithFrame:NSRectFromCGRect(self.bounds)]; [_webView setAutoresizingMask:(NSViewWidthSizable|NSViewHeightSizable)]; [_webView setPolicyDelegate:self]; [_webView setFrameLoadDelegate:self]; [_webView setUIDelegate:self]; [_webView setDrawsBackground:NO]; _webViewAdapter = [[UIViewAdapter alloc] initWithFrame:self.bounds]; _webViewAdapter.NSView = _webView; _webViewAdapter.scrollEnabled = NO; // WebView does its own scrolling :/ [self addSubview:_webViewAdapter]; } return self; } - (void)dealloc { [_webView setPolicyDelegate:nil]; [_webView setFrameLoadDelegate:nil]; [_webView setUIDelegate:nil]; [_webViewAdapter release]; [_webView release]; [super dealloc]; } - (void)layoutSubviews { [super layoutSubviews]; _webViewAdapter.frame = self.bounds; } - (void)setDelegate:(id)newDelegate { _delegate = newDelegate; _delegateHas.shouldStartLoadWithRequest = [_delegate respondsToSelector:@selector(webView:shouldStartLoadWithRequest:navigationType:)]; _delegateHas.didFailLoadWithError = [_delegate respondsToSelector:@selector(webView:didFailLoadWithError:)]; _delegateHas.didFinishLoad = [_delegate respondsToSelector:@selector(webViewDidFinishLoad:)]; } - (void)loadHTMLString:(NSString *)string baseURL:(NSURL *)baseURL { [[_webView mainFrame] loadHTMLString:string baseURL:baseURL]; } - (void)loadRequest:(NSURLRequest *)request { if (request != _request) { [_request release]; _request = [request retain]; } [[_webView mainFrame] loadRequest:_request]; } - (void)stopLoading { [_webView stopLoading:self]; } - (void)reload { [_webView reload:self]; } - (void)goBack { [_webView goBack]; } - (void)goForward { [_webView goForward]; } - (BOOL)isLoading { return [_webView isLoading]; } - (BOOL)canGoBack { return [_webView canGoBack]; } - (BOOL)canGoForward { return [_webView canGoForward]; } - (BOOL)scalesPageToFit { return false; } - (void)setScalesPageToFit:(BOOL)scalesPageToFit { } - (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script { return [_webView stringByEvaluatingJavaScriptFromString:script]; } // The only reason this is here is because Flamingo currently tries a hack to get at the web view's internals UIScrollView to get // the desk ad view to stop stealing the scrollsToTop event. Lame, yes... - (id)valueForUndefinedKey:(NSString *)key { return nil; } #pragma mark - #pragma mark WebView Policy Delegate - (void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id < WebPolicyDecisionListener >)listener { BOOL shouldStartLoad = NO; if (_delegateHas.shouldStartLoadWithRequest) { id navTypeObject = [actionInformation objectForKey:WebActionNavigationTypeKey]; NSInteger navTypeCode = [navTypeObject intValue]; UIWebViewNavigationType navType = UIWebViewNavigationTypeOther; switch (navTypeCode) { case WebNavigationTypeLinkClicked: navType = UIWebViewNavigationTypeLinkClicked; break; case WebNavigationTypeFormSubmitted: navType = UIWebViewNavigationTypeFormSubmitted; break; case WebNavigationTypeBackForward: navType = UIWebViewNavigationTypeBackForward; break; case WebNavigationTypeReload: navType = UIWebViewNavigationTypeReload; break; case WebNavigationTypeFormResubmitted: navType = UIWebViewNavigationTypeFormResubmitted; break; } shouldStartLoad = [_delegate webView:self shouldStartLoadWithRequest:request navigationType:navType]; } else { shouldStartLoad = YES; } if (shouldStartLoad) { [listener use]; } else { [listener ignore]; } } #pragma mark - #pragma mark WebView Frame Load Delegate - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame { if (_delegateHas.didFinishLoad) { [_delegate webViewDidFinishLoad:self]; } // [_webViewAdapter becomeFirstResponder]; // [_webViewAdapter setNeedsDisplay]; } - (void)webView:(WebView *)sender didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame { if (_delegateHas.didFailLoadWithError) { [_delegate webView:self didFailLoadWithError:error]; } } #pragma mark - #pragma mark WebView UI Delegate - (void)webView:(WebView *)sender makeFirstResponder:(NSResponder *)responder { [[_webViewAdapter.NSView window] makeFirstResponder:responder]; } - (NSArray *)webView:(WebView *)sender contextMenuItemsForElement:(NSDictionary *)element defaultMenuItems:(NSArray *)defaultMenuItems { return [NSArray array]; } - (BOOL)webViewIsResizable:(WebView *)sender { return NO; } - (BOOL)canBecomeFirstResponder { return YES; } - (void)webView:(WebView *)sender setFrame:(NSRect)frame { // DO NOTHING to prevent WebView resize window } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIWindow+UIPrivate.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIWindow.h" @interface UIWindow (UIPrivate) - (UIResponder *)_firstResponder; - (void)_setFirstResponder:(UIResponder *)newFirstResponder; - (void)_makeHidden; - (void)_makeVisible; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIWindow.h ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIView.h" typedef CGFloat UIWindowLevel; extern const UIWindowLevel UIWindowLevelNormal; extern const UIWindowLevel UIWindowLevelStatusBar; extern const UIWindowLevel UIWindowLevelAlert; extern NSString *const UIWindowDidBecomeVisibleNotification; extern NSString *const UIWindowDidBecomeHiddenNotification; extern NSString *const UIWindowDidBecomeKeyNotification; extern NSString *const UIWindowDidResignKeyNotification; extern NSString *const UIKeyboardWillShowNotification; extern NSString *const UIKeyboardDidShowNotification; extern NSString *const UIKeyboardWillHideNotification; extern NSString *const UIKeyboardDidHideNotification; extern NSString *const UIKeyboardFrameBeginUserInfoKey; extern NSString *const UIKeyboardFrameEndUserInfoKey; extern NSString *const UIKeyboardAnimationDurationUserInfoKey; extern NSString *const UIKeyboardAnimationCurveUserInfoKey; // deprecated extern NSString *const UIKeyboardCenterBeginUserInfoKey; extern NSString *const UIKeyboardCenterEndUserInfoKey; extern NSString *const UIKeyboardBoundsUserInfoKey; @class UIScreen, UIViewController; @interface UIWindow : UIView { @private UIScreen *_screen; UIResponder *_firstResponder; NSUndoManager *_undoManager; UIViewController *_rootViewController; } - (CGPoint)convertPoint:(CGPoint)toConvert toWindow:(UIWindow *)toWindow; - (CGPoint)convertPoint:(CGPoint)toConvert fromWindow:(UIWindow *)fromWindow; - (CGRect)convertRect:(CGRect)toConvert fromWindow:(UIWindow *)fromWindow; - (CGRect)convertRect:(CGRect)toConvert toWindow:(UIWindow *)toWindow; - (void)makeKeyWindow; - (void)makeKeyAndVisible; - (void)resignKeyWindow; - (void)becomeKeyWindow; - (void)sendEvent:(UIEvent *)event; @property (nonatomic, readonly, getter=isKeyWindow) BOOL keyWindow; @property (nonatomic, strong) UIScreen *screen; @property (nonatomic, assign) UIWindowLevel windowLevel; @property (nonatomic, strong) UIViewController *rootViewController; @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Classes/UIWindow.m ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "UIWindow+UIPrivate.h" #import "UIView+UIPrivate.h" #import "UIScreen+UIPrivate.h" #import "UIScreenAppKitIntegration.h" #import "UIApplication+UIPrivate.h" #import "UIEvent.h" #import "UITouch+UIPrivate.h" #import "UIScreenMode.h" #import "UIResponderAppKitIntegration.h" #import "UIViewController.h" #import "UIGestureRecognizerSubclass.h" #import "UIGestureRecognizer+UIPrivate.h" #import #import const UIWindowLevel UIWindowLevelNormal = 0; const UIWindowLevel UIWindowLevelStatusBar = 1000; const UIWindowLevel UIWindowLevelAlert = 2000; NSString *const UIWindowDidBecomeVisibleNotification = @"UIWindowDidBecomeVisibleNotification"; NSString *const UIWindowDidBecomeHiddenNotification = @"UIWindowDidBecomeHiddenNotification"; NSString *const UIWindowDidBecomeKeyNotification = @"UIWindowDidBecomeKeyNotification"; NSString *const UIWindowDidResignKeyNotification = @"UIWindowDidResignKeyNotification"; NSString *const UIKeyboardWillShowNotification = @"UIKeyboardWillShowNotification"; NSString *const UIKeyboardDidShowNotification = @"UIKeyboardDidShowNotification"; NSString *const UIKeyboardWillHideNotification = @"UIKeyboardWillHideNotification"; NSString *const UIKeyboardDidHideNotification = @"UIKeyboardDidHideNotification"; NSString *const UIKeyboardFrameBeginUserInfoKey = @"UIKeyboardFrameBeginUserInfoKey"; NSString *const UIKeyboardFrameEndUserInfoKey = @"UIKeyboardFrameEndUserInfoKey"; NSString *const UIKeyboardAnimationDurationUserInfoKey = @"UIKeyboardAnimationDurationUserInfoKey"; NSString *const UIKeyboardAnimationCurveUserInfoKey = @"UIKeyboardAnimationCurveUserInfoKey"; // deprecated NSString *const UIKeyboardCenterBeginUserInfoKey = @"UIKeyboardCenterBeginUserInfoKey"; NSString *const UIKeyboardCenterEndUserInfoKey = @"UIKeyboardCenterEndUserInfoKey"; NSString *const UIKeyboardBoundsUserInfoKey = @"UIKeyboardBoundsUserInfoKey"; @implementation UIWindow @synthesize screen=_screen, rootViewController=_rootViewController; - (id)initWithFrame:(CGRect)theFrame { if ((self=[super initWithFrame:theFrame])) { _undoManager = [[NSUndoManager alloc] init]; [self _makeHidden]; // do this first because before the screen is set, it will prevent any visibility notifications from being sent. self.screen = [UIScreen mainScreen]; self.opaque = NO; } return self; } - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; [self _makeHidden]; // I don't really like this here, but the real UIKit seems to do something like this on window destruction as it sends a notification and we also need to remove it from the app's list of windows [_screen release]; [_undoManager release]; [_rootViewController release]; // since UIView's dealloc is called after this one, it's hard ot say what might happen in there due to all of the subview removal stuff // so it's safer to make sure these things are nil now rather than potential garbage. I don't like how much work UIView's -dealloc is doing // but at the moment I don't see a good way around it... _screen = nil; _undoManager = nil; _rootViewController = nil; [super dealloc]; } - (UIResponder *)_firstResponder { return _firstResponder; } - (void)_setFirstResponder:(UIResponder *)newFirstResponder { _firstResponder = newFirstResponder; } - (NSUndoManager *)undoManager { return _undoManager; } - (UIView *)superview { return nil; // lies! } - (void)removeFromSuperview { // does nothing } - (UIWindow *)window { return self; } - (UIResponder *)nextResponder { return [UIApplication sharedApplication]; } - (void)setRootViewController:(UIViewController *)rootViewController { if (rootViewController != _rootViewController) { [self.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)]; [_rootViewController release]; _rootViewController = [rootViewController retain]; _rootViewController.view.frame = self.bounds; // unsure about this [self addSubview:_rootViewController.view]; } } - (void)setScreen:(UIScreen *)theScreen { if (theScreen != _screen) { [[NSNotificationCenter defaultCenter] removeObserver:self name:UIScreenModeDidChangeNotification object:_screen]; const BOOL wasHidden = self.hidden; [self _makeHidden]; [self.layer removeFromSuperlayer]; [_screen release]; _screen = [theScreen retain]; [[_screen _layer] addSublayer:self.layer]; if (!wasHidden) { [self _makeVisible]; } [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_screenModeChangedNotification:) name:UIScreenModeDidChangeNotification object:_screen]; } } - (void)_screenModeChangedNotification:(NSNotification *)note { UIScreenMode *previousMode = [[note userInfo] objectForKey:@"_previousMode"]; UIScreenMode *newMode = _screen.currentMode; if (!CGSizeEqualToSize(previousMode.size,newMode.size)) { [self _superviewSizeDidChangeFrom:previousMode.size to:newMode.size]; } } - (CGPoint)convertPoint:(CGPoint)toConvert toWindow:(UIWindow *)toWindow { if (toWindow == self) { return toConvert; } else { // Convert to screen coordinates toConvert.x += self.frame.origin.x; toConvert.y += self.frame.origin.y; if (toWindow) { // Now convert the screen coords into the other screen's coordinate space toConvert = [self.screen convertPoint:toConvert toScreen:toWindow.screen]; // And now convert it from the new screen's space into the window's space toConvert.x -= toWindow.frame.origin.x; toConvert.y -= toWindow.frame.origin.y; } return toConvert; } } - (CGPoint)convertPoint:(CGPoint)toConvert fromWindow:(UIWindow *)fromWindow { if (fromWindow == self) { return toConvert; } else { if (fromWindow) { // Convert to screen coordinates toConvert.x += fromWindow.frame.origin.x; toConvert.y += fromWindow.frame.origin.y; // Change to this screen. toConvert = [self.screen convertPoint:toConvert fromScreen:fromWindow.screen]; } // Convert to window coordinates toConvert.x -= self.frame.origin.x; toConvert.y -= self.frame.origin.y; return toConvert; } } - (CGRect)convertRect:(CGRect)toConvert fromWindow:(UIWindow *)fromWindow { CGPoint convertedOrigin = [self convertPoint:toConvert.origin fromWindow:fromWindow]; return CGRectMake(convertedOrigin.x, convertedOrigin.y, toConvert.size.width, toConvert.size.height); } - (CGRect)convertRect:(CGRect)toConvert toWindow:(UIWindow *)toWindow { CGPoint convertedOrigin = [self convertPoint:toConvert.origin toWindow:toWindow]; return CGRectMake(convertedOrigin.x, convertedOrigin.y, toConvert.size.width, toConvert.size.height); } - (void)becomeKeyWindow { if ([[self _firstResponder] respondsToSelector:@selector(becomeKeyWindow)]) { [(id)[self _firstResponder] becomeKeyWindow]; } [[NSNotificationCenter defaultCenter] postNotificationName:UIWindowDidBecomeKeyNotification object:self]; } - (void)makeKeyWindow { if (!self.isKeyWindow) { [[UIApplication sharedApplication].keyWindow resignKeyWindow]; [[UIApplication sharedApplication] _setKeyWindow:self]; [self becomeKeyWindow]; } } - (BOOL)isKeyWindow { return ([UIApplication sharedApplication].keyWindow == self); } - (void)resignKeyWindow { if ([[self _firstResponder] respondsToSelector:@selector(resignKeyWindow)]) { [(id)[self _firstResponder] resignKeyWindow]; } [[NSNotificationCenter defaultCenter] postNotificationName:UIWindowDidResignKeyNotification object:self]; } - (void)_makeHidden { if (!self.hidden) { [super setHidden:YES]; if (self.screen) { [[UIApplication sharedApplication] _windowDidBecomeHidden:self]; [[NSNotificationCenter defaultCenter] postNotificationName:UIWindowDidBecomeHiddenNotification object:self]; } } } - (void)_makeVisible { if (self.hidden) { [super setHidden:NO]; if (self.screen) { [[UIApplication sharedApplication] _windowDidBecomeVisible:self]; [[NSNotificationCenter defaultCenter] postNotificationName:UIWindowDidBecomeVisibleNotification object:self]; } } } - (void)setHidden:(BOOL)hide { if (hide) { [self _makeHidden]; } else { [self _makeVisible]; } } - (void)makeKeyAndVisible { [self _makeVisible]; [self makeKeyWindow]; } - (void)setWindowLevel:(UIWindowLevel)level { self.layer.zPosition = level; } - (UIWindowLevel)windowLevel { return self.layer.zPosition; } - (void)sendEvent:(UIEvent *)event { if (event.type == UIEventTypeTouches) { NSSet *touches = [event touchesForWindow:self]; NSMutableSet *gestureRecognizers = [NSMutableSet setWithCapacity:0]; for (UITouch *touch in touches) { [gestureRecognizers addObjectsFromArray:touch.gestureRecognizers]; } for (UIGestureRecognizer *recognizer in gestureRecognizers) { [recognizer _recognizeTouches:touches withEvent:event]; } for (UITouch *touch in touches) { // normally there'd be no need to retain the view here, but this works around a strange problem I ran into. // what can happen is, now that UIView's -removeFromSuperview will remove the view from the active touch // instead of just cancel the touch (which is how I had implemented it previously - which was wrong), the // situation can arise where, in response to a touch event of some kind, the view may remove itself from its // superview in some fashion, which means that the handling of the touchesEnded:withEvent: (or whatever) // methods could somehow result in the view itself being destroyed before the method is even finished running! // I ran into this in particular with a load more button in Twitterrific which would crash in UIControl's // touchesEnded: implemention after sending actions to the registered targets (because one of those targets // ended up removing the button from view and thus reducing its retain count to 0). For some reason, even // though I attempted to rearrange stuff in UIControl so that actions were always the last thing done, it'd // still end up crashing when one of the internal methods returned to touchesEnded:, which didn't make sense // to me because there was no code after that (at the time) and therefore it should just have been unwinding // the stack to eventually get back here and all should have been okay. I never figured out exactly why that // crashed in that way, but by putting a retain here it works around this problem and perhaps others that have // gone so-far unnoticed. Converting to ARC should also work with this solution because there will be a local // strong reference to the view retainined throughout the rest of this logic and thus the same protection // against mid-method view destrustion should be provided under ARC. If someone can figure out some other, // better way to fix this without it having to have this hacky-feeling retain here, that'd be cool, but be // aware that this is here for a reason and that the problem it prevents is very rare and somewhat contrived. UIView *view = [touch.view retain]; const UITouchPhase phase = touch.phase; const _UITouchGesture gesture = [touch _gesture]; if (phase == UITouchPhaseBegan) { [view touchesBegan:touches withEvent:event]; } else if (phase == UITouchPhaseMoved) { [view touchesMoved:touches withEvent:event]; } else if (phase == UITouchPhaseEnded) { [view touchesEnded:touches withEvent:event]; } else if (phase == UITouchPhaseCancelled) { [view touchesCancelled:touches withEvent:event]; } else if (phase == _UITouchPhaseDiscreteGesture && gesture == _UITouchDiscreteGestureMouseMove) { if ([view hitTest:[touch locationInView:view] withEvent:event]) { [view mouseMoved:[touch _delta] withEvent:event]; } } else if (phase == _UITouchPhaseDiscreteGesture && gesture == _UITouchDiscreteGestureRightClick) { [view rightClick:touch withEvent:event]; } else if ((phase == _UITouchPhaseDiscreteGesture && gesture == _UITouchDiscreteGestureScrollWheel) || (phase == _UITouchPhaseGestureChanged && gesture == _UITouchGesturePan)) { [view scrollWheelMoved:[touch _delta] withEvent:event]; } NSCursor *newCursor = [view mouseCursorForEvent:event] ?: [NSCursor arrowCursor]; if ([NSCursor currentCursor] != newCursor) { [newCursor set]; } [view release]; } } } @end ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/Info.plist ================================================ CFBundleDevelopmentRegion English CFBundleExecutable ${EXECUTABLE_NAME} CFBundleName ${PRODUCT_NAME} CFBundleIconFile CFBundleIdentifier org.chameleonproject.UIKit CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType FMWK CFBundleSignature ???? CFBundleVersion 1 CFBundleShortVersionString 1.0 NSPrincipalClass ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/UIKit.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 1413D21213D72A06004D77E9 /* UIScrollViewAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 1413D20C13D72A06004D77E9 /* UIScrollViewAnimation.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1413D21313D72A06004D77E9 /* UIScrollViewAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 1413D20D13D72A06004D77E9 /* UIScrollViewAnimation.m */; }; 1413D21413D72A06004D77E9 /* UIScrollViewAnimationDeceleration.h in Headers */ = {isa = PBXBuildFile; fileRef = 1413D20E13D72A06004D77E9 /* UIScrollViewAnimationDeceleration.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1413D21513D72A06004D77E9 /* UIScrollViewAnimationDeceleration.m in Sources */ = {isa = PBXBuildFile; fileRef = 1413D20F13D72A06004D77E9 /* UIScrollViewAnimationDeceleration.m */; }; 1413D21613D72A06004D77E9 /* UIScrollViewAnimationScroll.h in Headers */ = {isa = PBXBuildFile; fileRef = 1413D21013D72A06004D77E9 /* UIScrollViewAnimationScroll.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1413D21713D72A06004D77E9 /* UIScrollViewAnimationScroll.m in Sources */ = {isa = PBXBuildFile; fileRef = 1413D21113D72A06004D77E9 /* UIScrollViewAnimationScroll.m */; }; 1426A02315701598004C2C9A /* reply@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1426A01E15701598004C2C9A /* reply@2x.png */; }; 1426A02415701598004C2C9A /* arrow-bottom@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1426A01F15701598004C2C9A /* arrow-bottom@2x.png */; }; 1426A02515701598004C2C9A /* arrow-left@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1426A02015701598004C2C9A /* arrow-left@2x.png */; }; 1426A02615701598004C2C9A /* arrow-right@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1426A02115701598004C2C9A /* arrow-right@2x.png */; }; 1426A02715701598004C2C9A /* arrow-top@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1426A02215701598004C2C9A /* arrow-top@2x.png */; }; 1426FFDD129ADEA300BD31E5 /* UIControlAction.h in Headers */ = {isa = PBXBuildFile; fileRef = 1426FFDB129ADEA300BD31E5 /* UIControlAction.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1426FFDE129ADEA300BD31E5 /* UIControlAction.m in Sources */ = {isa = PBXBuildFile; fileRef = 1426FFDC129ADEA300BD31E5 /* UIControlAction.m */; }; 144156DB1284A22200532FE2 /* UIToolbarButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 144156D91284A22200532FE2 /* UIToolbarButton.h */; settings = {ATTRIBUTES = (Private, ); }; }; 144156DC1284A22200532FE2 /* UIToolbarButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 144156DA1284A22200532FE2 /* UIToolbarButton.m */; }; 1443B06C13E06081001D7EC1 /* UIBackgroundTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 1443B06A13E06081001D7EC1 /* UIBackgroundTask.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1443B06D13E06081001D7EC1 /* UIBackgroundTask.m in Sources */ = {isa = PBXBuildFile; fileRef = 1443B06B13E06081001D7EC1 /* UIBackgroundTask.m */; }; 1443DF24121F0D5A00E07C4A /* UIScreenMode+UIPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1443DF23121F0D5A00E07C4A /* UIScreenMode+UIPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1444318E137D7FEE00B81304 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1444318D137D7FEE00B81304 /* IOKit.framework */; }; 145335651226F03E0005644F /* UITextLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 145335631226F03E0005644F /* UITextLayer.h */; settings = {ATTRIBUTES = (Private, ); }; }; 145335661226F03E0005644F /* UITextLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 145335641226F03E0005644F /* UITextLayer.m */; }; 145335691226F1F90005644F /* UIBulletGlyphGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = 145335671226F1F90005644F /* UIBulletGlyphGenerator.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1453356A1226F1F90005644F /* UIBulletGlyphGenerator.m in Sources */ = {isa = PBXBuildFile; fileRef = 145335681226F1F90005644F /* UIBulletGlyphGenerator.m */; }; 145335711226F2720005644F /* UICustomNSTextView.h in Headers */ = {isa = PBXBuildFile; fileRef = 1453356F1226F2720005644F /* UICustomNSTextView.h */; settings = {ATTRIBUTES = (Private, ); }; }; 145335721226F2720005644F /* UICustomNSTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 145335701226F2720005644F /* UICustomNSTextView.m */; }; 145335851226F3490005644F /* UICustomNSClipView.h in Headers */ = {isa = PBXBuildFile; fileRef = 145335831226F3490005644F /* UICustomNSClipView.h */; settings = {ATTRIBUTES = (Private, ); }; }; 145335861226F3490005644F /* UICustomNSClipView.m in Sources */ = {isa = PBXBuildFile; fileRef = 145335841226F3490005644F /* UICustomNSClipView.m */; }; 14541DB21360D6F300C1006D /* UIPhotosAlbum.h in Headers */ = {isa = PBXBuildFile; fileRef = 14541DB01360D6F300C1006D /* UIPhotosAlbum.h */; settings = {ATTRIBUTES = (Private, ); }; }; 14541DB31360D6F300C1006D /* UIPhotosAlbum.m in Sources */ = {isa = PBXBuildFile; fileRef = 14541DB11360D6F300C1006D /* UIPhotosAlbum.m */; }; 145576231541DC560029EF4D /* UIAppearanceInstance.h in Headers */ = {isa = PBXBuildFile; fileRef = 145576221541DC560029EF4D /* UIAppearanceInstance.h */; }; 145576261541DC830029EF4D /* UIAppearanceInstance.m in Sources */ = {isa = PBXBuildFile; fileRef = 145576251541DC830029EF4D /* UIAppearanceInstance.m */; }; 1457DD3F128DDE610057A7F9 /* UITransitionView.h in Headers */ = {isa = PBXBuildFile; fileRef = 1457DD3D128DDE610057A7F9 /* UITransitionView.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1457DD40128DDE610057A7F9 /* UITransitionView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1457DD3E128DDE610057A7F9 /* UITransitionView.m */; }; 145BE31D15754F2400C41D70 /* UIColorRep.h in Headers */ = {isa = PBXBuildFile; fileRef = 145BE31B15754F2400C41D70 /* UIColorRep.h */; }; 145BE31E15754F2400C41D70 /* UIColorRep.m in Sources */ = {isa = PBXBuildFile; fileRef = 145BE31C15754F2400C41D70 /* UIColorRep.m */; }; 145BE3211575523000C41D70 /* UIColor+UIPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 145BE3201575523000C41D70 /* UIColor+UIPrivate.h */; }; 1464960B11FF7AE500ECEC7A /* back-highlighted.png in Resources */ = {isa = PBXBuildFile; fileRef = 1464960711FF7AE500ECEC7A /* back-highlighted.png */; }; 1464960C11FF7AE500ECEC7A /* back.png in Resources */ = {isa = PBXBuildFile; fileRef = 1464960811FF7AE500ECEC7A /* back.png */; }; 14711394156FC83F00251B2E /* UIImageRep.h in Headers */ = {isa = PBXBuildFile; fileRef = 14711392156FC83F00251B2E /* UIImageRep.h */; }; 14711395156FC83F00251B2E /* UIImageRep.m in Sources */ = {isa = PBXBuildFile; fileRef = 14711393156FC83F00251B2E /* UIImageRep.m */; }; 14805D4112A6B0E80080C4BA /* UINSClipView.h in Headers */ = {isa = PBXBuildFile; fileRef = 14805D3F12A6B0E80080C4BA /* UINSClipView.h */; settings = {ATTRIBUTES = (Private, ); }; }; 14805D4212A6B0E80080C4BA /* UINSClipView.m in Sources */ = {isa = PBXBuildFile; fileRef = 14805D4012A6B0E80080C4BA /* UINSClipView.m */; }; 14805F5A12A6E2AE0080C4BA /* UIScrollView+UIPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 14805F5812A6E2AE0080C4BA /* UIScrollView+UIPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1480633612A851230080C4BA /* QTKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1480633512A851230080C4BA /* QTKit.framework */; }; 1480633812A851230080C4BA /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1480633712A851230080C4BA /* WebKit.framework */; }; 148984A512EE278D003D4751 /* UIGestureRecognizer+UIPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 148984A312EE278D003D4751 /* UIGestureRecognizer+UIPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1489856A12EE2CFF003D4751 /* AppKitIntegration.h in Headers */ = {isa = PBXBuildFile; fileRef = 148984E412EE2CFE003D4751 /* AppKitIntegration.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1489856B12EE2CFF003D4751 /* NSIndexPath+UITableView.h in Headers */ = {isa = PBXBuildFile; fileRef = 148984E512EE2CFE003D4751 /* NSIndexPath+UITableView.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1489856C12EE2CFF003D4751 /* NSIndexPath+UITableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 148984E612EE2CFE003D4751 /* NSIndexPath+UITableView.m */; }; 1489856D12EE2CFF003D4751 /* UIAcceleration.h in Headers */ = {isa = PBXBuildFile; fileRef = 148984E712EE2CFE003D4751 /* UIAcceleration.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1489856E12EE2CFF003D4751 /* UIAcceleration.m in Sources */ = {isa = PBXBuildFile; fileRef = 148984E812EE2CFE003D4751 /* UIAcceleration.m */; }; 1489856F12EE2CFF003D4751 /* UIAccelerometer.h in Headers */ = {isa = PBXBuildFile; fileRef = 148984E912EE2CFE003D4751 /* UIAccelerometer.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1489857012EE2CFF003D4751 /* UIAccelerometer.m in Sources */ = {isa = PBXBuildFile; fileRef = 148984EA12EE2CFE003D4751 /* UIAccelerometer.m */; }; 1489857112EE2CFF003D4751 /* UIAccessibility.h in Headers */ = {isa = PBXBuildFile; fileRef = 148984EB12EE2CFE003D4751 /* UIAccessibility.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1489857212EE2CFF003D4751 /* UIAccessibility.m in Sources */ = {isa = PBXBuildFile; fileRef = 148984EC12EE2CFE003D4751 /* UIAccessibility.m */; }; 1489857312EE2CFF003D4751 /* UIAccessibilityElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 148984ED12EE2CFE003D4751 /* UIAccessibilityElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1489857412EE2CFF003D4751 /* UIAccessibilityElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 148984EE12EE2CFE003D4751 /* UIAccessibilityElement.m */; }; 1489857512EE2CFF003D4751 /* UIActionSheet.h in Headers */ = {isa = PBXBuildFile; fileRef = 148984EF12EE2CFE003D4751 /* UIActionSheet.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1489857612EE2CFF003D4751 /* UIActionSheet.m in Sources */ = {isa = PBXBuildFile; fileRef = 148984F012EE2CFE003D4751 /* UIActionSheet.m */; }; 1489857712EE2CFF003D4751 /* UIActionSheetAppKitIntegration.h in Headers */ = {isa = PBXBuildFile; fileRef = 148984F112EE2CFE003D4751 /* UIActionSheetAppKitIntegration.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1489857812EE2CFF003D4751 /* UIActivityIndicatorView.h in Headers */ = {isa = PBXBuildFile; fileRef = 148984F212EE2CFE003D4751 /* UIActivityIndicatorView.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1489857912EE2CFF003D4751 /* UIActivityIndicatorView.m in Sources */ = {isa = PBXBuildFile; fileRef = 148984F312EE2CFE003D4751 /* UIActivityIndicatorView.m */; }; 1489857A12EE2CFF003D4751 /* UIAlertView.h in Headers */ = {isa = PBXBuildFile; fileRef = 148984F412EE2CFE003D4751 /* UIAlertView.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1489857B12EE2CFF003D4751 /* UIAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = 148984F512EE2CFE003D4751 /* UIAlertView.m */; }; 1489857C12EE2CFF003D4751 /* UIApplication.h in Headers */ = {isa = PBXBuildFile; fileRef = 148984F612EE2CFE003D4751 /* UIApplication.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1489857D12EE2CFF003D4751 /* UIApplication.m in Sources */ = {isa = PBXBuildFile; fileRef = 148984F712EE2CFE003D4751 /* UIApplication.m */; }; 1489857E12EE2CFF003D4751 /* UIApplicationAppKitIntegration.h in Headers */ = {isa = PBXBuildFile; fileRef = 148984F812EE2CFE003D4751 /* UIApplicationAppKitIntegration.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1489857F12EE2CFF003D4751 /* UIApplicationDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 148984F912EE2CFE003D4751 /* UIApplicationDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1489858012EE2CFF003D4751 /* UIBarButtonItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 148984FA12EE2CFE003D4751 /* UIBarButtonItem.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1489858112EE2CFF003D4751 /* UIBarButtonItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 148984FB12EE2CFE003D4751 /* UIBarButtonItem.m */; }; 1489858212EE2CFF003D4751 /* UIBarItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 148984FC12EE2CFE003D4751 /* UIBarItem.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1489858312EE2CFF003D4751 /* UIBarItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 148984FD12EE2CFE003D4751 /* UIBarItem.m */; }; 1489858412EE2CFF003D4751 /* UIBezierPath.h in Headers */ = {isa = PBXBuildFile; fileRef = 148984FE12EE2CFE003D4751 /* UIBezierPath.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1489858512EE2CFF003D4751 /* UIBezierPath.m in Sources */ = {isa = PBXBuildFile; fileRef = 148984FF12EE2CFE003D4751 /* UIBezierPath.m */; }; 1489858612EE2CFF003D4751 /* UIButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489850012EE2CFE003D4751 /* UIButton.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1489858712EE2CFF003D4751 /* UIButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489850112EE2CFE003D4751 /* UIButton.m */; }; 1489858812EE2CFF003D4751 /* UIColor.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489850212EE2CFE003D4751 /* UIColor.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1489858912EE2CFF003D4751 /* UIColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489850312EE2CFE003D4751 /* UIColor.m */; }; 1489858A12EE2CFF003D4751 /* UIColorAppKitIntegration.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489850412EE2CFE003D4751 /* UIColorAppKitIntegration.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1489858B12EE2CFF003D4751 /* UIControl.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489850512EE2CFE003D4751 /* UIControl.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1489858C12EE2CFF003D4751 /* UIControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489850612EE2CFE003D4751 /* UIControl.m */; }; 1489858D12EE2CFF003D4751 /* UIDataDetectors.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489850712EE2CFE003D4751 /* UIDataDetectors.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1489858E12EE2CFF003D4751 /* UIDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489850812EE2CFE003D4751 /* UIDevice.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1489858F12EE2CFF003D4751 /* UIDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489850912EE2CFE003D4751 /* UIDevice.m */; }; 1489859012EE2CFF003D4751 /* UIEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489850A12EE2CFE003D4751 /* UIEvent.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1489859112EE2CFF003D4751 /* UIEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489850B12EE2CFE003D4751 /* UIEvent.m */; }; 1489859212EE2CFF003D4751 /* UIFont.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489850C12EE2CFE003D4751 /* UIFont.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1489859312EE2CFF003D4751 /* UIFont.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489850D12EE2CFE003D4751 /* UIFont.m */; }; 1489859412EE2CFF003D4751 /* UIFontAppKitIntegration.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489850E12EE2CFE003D4751 /* UIFontAppKitIntegration.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1489859512EE2CFF003D4751 /* UIGeometry.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489850F12EE2CFE003D4751 /* UIGeometry.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1489859612EE2CFF003D4751 /* UIGeometry.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489851012EE2CFE003D4751 /* UIGeometry.m */; }; 1489859712EE2CFF003D4751 /* UIGestureRecognizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489851112EE2CFE003D4751 /* UIGestureRecognizer.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1489859812EE2CFF003D4751 /* UIGestureRecognizer.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489851212EE2CFE003D4751 /* UIGestureRecognizer.m */; }; 1489859912EE2CFF003D4751 /* UIGraphics.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489851312EE2CFE003D4751 /* UIGraphics.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1489859A12EE2CFF003D4751 /* UIGraphics.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489851412EE2CFE003D4751 /* UIGraphics.m */; }; 1489859B12EE2CFF003D4751 /* UIImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489851512EE2CFE003D4751 /* UIImage.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1489859C12EE2CFF003D4751 /* UIImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489851612EE2CFE003D4751 /* UIImage.m */; }; 1489859D12EE2CFF003D4751 /* UIImageAppKitIntegration.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489851712EE2CFE003D4751 /* UIImageAppKitIntegration.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1489859E12EE2CFF003D4751 /* UIImagePickerController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489851812EE2CFE003D4751 /* UIImagePickerController.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1489859F12EE2CFF003D4751 /* UIImagePickerController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489851912EE2CFE003D4751 /* UIImagePickerController.m */; }; 148985A012EE2CFF003D4751 /* UIImageView.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489851A12EE2CFE003D4751 /* UIImageView.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985A112EE2CFF003D4751 /* UIImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489851B12EE2CFE003D4751 /* UIImageView.m */; }; 148985A212EE2CFF003D4751 /* UIKey.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489851C12EE2CFE003D4751 /* UIKey.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985A312EE2CFF003D4751 /* UIKey.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489851D12EE2CFE003D4751 /* UIKey.m */; }; 148985A412EE2CFF003D4751 /* UIKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489851E12EE2CFE003D4751 /* UIKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985A512EE2CFF003D4751 /* UIKitView.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489851F12EE2CFE003D4751 /* UIKitView.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985A612EE2CFF003D4751 /* UIKitView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489852012EE2CFE003D4751 /* UIKitView.m */; }; 148985A712EE2CFF003D4751 /* UILabel.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489852112EE2CFE003D4751 /* UILabel.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985A812EE2CFF003D4751 /* UILabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489852212EE2CFE003D4751 /* UILabel.m */; }; 148985A912EE2CFF003D4751 /* UILongPressGestureRecognizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489852312EE2CFE003D4751 /* UILongPressGestureRecognizer.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985AA12EE2CFF003D4751 /* UILongPressGestureRecognizer.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489852412EE2CFE003D4751 /* UILongPressGestureRecognizer.m */; }; 148985AB12EE2CFF003D4751 /* UIMenuController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489852512EE2CFE003D4751 /* UIMenuController.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985AC12EE2CFF003D4751 /* UIMenuController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489852612EE2CFE003D4751 /* UIMenuController.m */; }; 148985AD12EE2CFF003D4751 /* UIMenuItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489852712EE2CFE003D4751 /* UIMenuItem.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985AE12EE2CFF003D4751 /* UIMenuItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489852812EE2CFE003D4751 /* UIMenuItem.m */; }; 148985AF12EE2CFF003D4751 /* UINavigationBar.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489852912EE2CFE003D4751 /* UINavigationBar.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985B012EE2CFF003D4751 /* UINavigationBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489852A12EE2CFE003D4751 /* UINavigationBar.m */; }; 148985B112EE2CFF003D4751 /* UINavigationController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489852B12EE2CFE003D4751 /* UINavigationController.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985B212EE2CFF003D4751 /* UINavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489852C12EE2CFE003D4751 /* UINavigationController.m */; }; 148985B312EE2CFF003D4751 /* UINavigationItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489852D12EE2CFE003D4751 /* UINavigationItem.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985B412EE2CFF003D4751 /* UINavigationItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489852E12EE2CFE003D4751 /* UINavigationItem.m */; }; 148985B512EE2CFF003D4751 /* UINibLoading.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489852F12EE2CFE003D4751 /* UINibLoading.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985B612EE2CFF003D4751 /* UINibLoading.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489853012EE2CFE003D4751 /* UINibLoading.m */; }; 148985B712EE2CFF003D4751 /* UIPageControl.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489853112EE2CFE003D4751 /* UIPageControl.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985B812EE2CFF003D4751 /* UIPageControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489853212EE2CFE003D4751 /* UIPageControl.m */; }; 148985B912EE2CFF003D4751 /* UIPasteboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489853312EE2CFE003D4751 /* UIPasteboard.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985BA12EE2CFF003D4751 /* UIPasteboard.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489853412EE2CFE003D4751 /* UIPasteboard.m */; }; 148985BB12EE2CFF003D4751 /* UIPinchGestureRecognizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489853512EE2CFE003D4751 /* UIPinchGestureRecognizer.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985BC12EE2CFF003D4751 /* UIPinchGestureRecognizer.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489853612EE2CFE003D4751 /* UIPinchGestureRecognizer.m */; }; 148985BD12EE2CFF003D4751 /* UIPopoverController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489853712EE2CFE003D4751 /* UIPopoverController.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985BE12EE2CFF003D4751 /* UIPopoverController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489853812EE2CFE003D4751 /* UIPopoverController.m */; }; 148985BF12EE2CFF003D4751 /* UIProgressView.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489853912EE2CFE003D4751 /* UIProgressView.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985C012EE2CFF003D4751 /* UIProgressView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489853A12EE2CFE003D4751 /* UIProgressView.m */; }; 148985C112EE2CFF003D4751 /* UIResponder.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489853B12EE2CFE003D4751 /* UIResponder.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985C212EE2CFF003D4751 /* UIResponder.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489853C12EE2CFE003D4751 /* UIResponder.m */; }; 148985C312EE2CFF003D4751 /* UIResponderAppKitIntegration.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489853D12EE2CFE003D4751 /* UIResponderAppKitIntegration.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985C412EE2CFF003D4751 /* UIResponderAppKitIntegration.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489853E12EE2CFE003D4751 /* UIResponderAppKitIntegration.m */; }; 148985C512EE2CFF003D4751 /* UIScreen.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489853F12EE2CFE003D4751 /* UIScreen.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985C612EE2CFF003D4751 /* UIScreen.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489854012EE2CFE003D4751 /* UIScreen.m */; }; 148985C712EE2CFF003D4751 /* UIScreenAppKitIntegration.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489854112EE2CFE003D4751 /* UIScreenAppKitIntegration.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985C812EE2CFF003D4751 /* UIScreenAppKitIntegration.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489854212EE2CFE003D4751 /* UIScreenAppKitIntegration.m */; }; 148985C912EE2CFF003D4751 /* UIScreenMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489854312EE2CFE003D4751 /* UIScreenMode.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985CA12EE2CFF003D4751 /* UIScreenMode.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489854412EE2CFE003D4751 /* UIScreenMode.m */; }; 148985CB12EE2CFF003D4751 /* UIScrollView.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489854512EE2CFE003D4751 /* UIScrollView.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985CC12EE2CFF003D4751 /* UIScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489854612EE2CFE003D4751 /* UIScrollView.m */; }; 148985CD12EE2CFF003D4751 /* UISplitViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489854712EE2CFE003D4751 /* UISplitViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985CE12EE2CFF003D4751 /* UISplitViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489854812EE2CFE003D4751 /* UISplitViewController.m */; }; 148985CF12EE2CFF003D4751 /* UIStringDrawing.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489854912EE2CFE003D4751 /* UIStringDrawing.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985D012EE2CFF003D4751 /* UIStringDrawing.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489854A12EE2CFE003D4751 /* UIStringDrawing.m */; }; 148985D112EE2CFF003D4751 /* UISwitch.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489854B12EE2CFE003D4751 /* UISwitch.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985D212EE2CFF003D4751 /* UISwitch.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489854C12EE2CFE003D4751 /* UISwitch.m */; }; 148985D312EE2CFF003D4751 /* UITabBarController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489854D12EE2CFE003D4751 /* UITabBarController.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985D412EE2CFF003D4751 /* UITabBarController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489854E12EE2CFE003D4751 /* UITabBarController.m */; }; 148985D512EE2CFF003D4751 /* UITableView.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489854F12EE2CFE003D4751 /* UITableView.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985D612EE2CFF003D4751 /* UITableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489855012EE2CFE003D4751 /* UITableView.m */; }; 148985D712EE2CFF003D4751 /* UITableViewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489855112EE2CFE003D4751 /* UITableViewCell.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985D812EE2CFF003D4751 /* UITableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489855212EE2CFE003D4751 /* UITableViewCell.m */; }; 148985D912EE2CFF003D4751 /* UITableViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489855312EE2CFE003D4751 /* UITableViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985DA12EE2CFF003D4751 /* UITableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489855412EE2CFE003D4751 /* UITableViewController.m */; }; 148985DB12EE2CFF003D4751 /* UITapGestureRecognizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489855512EE2CFE003D4751 /* UITapGestureRecognizer.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985DC12EE2CFF003D4751 /* UITapGestureRecognizer.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489855612EE2CFE003D4751 /* UITapGestureRecognizer.m */; }; 148985DD12EE2CFF003D4751 /* UITextField.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489855712EE2CFE003D4751 /* UITextField.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985DE12EE2CFF003D4751 /* UITextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489855812EE2CFE003D4751 /* UITextField.m */; }; 148985DF12EE2CFF003D4751 /* UITextInputTraits.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489855912EE2CFE003D4751 /* UITextInputTraits.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985E012EE2CFF003D4751 /* UITextView.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489855A12EE2CFE003D4751 /* UITextView.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985E112EE2CFF003D4751 /* UITextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489855B12EE2CFE003D4751 /* UITextView.m */; }; 148985E212EE2CFF003D4751 /* UIToolbar.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489855C12EE2CFE003D4751 /* UIToolbar.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985E312EE2CFF003D4751 /* UIToolbar.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489855D12EE2CFE003D4751 /* UIToolbar.m */; }; 148985E412EE2CFF003D4751 /* UITouch.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489855E12EE2CFE003D4751 /* UITouch.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985E512EE2CFF003D4751 /* UITouch.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489855F12EE2CFE003D4751 /* UITouch.m */; }; 148985E612EE2CFF003D4751 /* UIView.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489856012EE2CFE003D4751 /* UIView.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985E712EE2CFF003D4751 /* UIView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489856112EE2CFE003D4751 /* UIView.m */; }; 148985E812EE2CFF003D4751 /* UIViewAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489856212EE2CFE003D4751 /* UIViewAdapter.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985E912EE2CFF003D4751 /* UIViewAdapter.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489856312EE2CFE003D4751 /* UIViewAdapter.m */; }; 148985EA12EE2CFF003D4751 /* UIViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489856412EE2CFE003D4751 /* UIViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985EB12EE2CFF003D4751 /* UIViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489856512EE2CFE003D4751 /* UIViewController.m */; }; 148985EC12EE2CFF003D4751 /* UIWebView.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489856612EE2CFE003D4751 /* UIWebView.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985ED12EE2CFF003D4751 /* UIWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489856712EE2CFE003D4751 /* UIWebView.m */; }; 148985EE12EE2CFF003D4751 /* UIWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489856812EE2CFE003D4751 /* UIWindow.h */; settings = {ATTRIBUTES = (Public, ); }; }; 148985EF12EE2CFF003D4751 /* UIWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489856912EE2CFE003D4751 /* UIWindow.m */; }; 1489860212EE2D9F003D4751 /* UIRotationGestureRecognizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489860012EE2D9F003D4751 /* UIRotationGestureRecognizer.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1489860312EE2D9F003D4751 /* UIRotationGestureRecognizer.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489860112EE2D9F003D4751 /* UIRotationGestureRecognizer.m */; }; 1489860612EE2DBD003D4751 /* UISwipeGestureRecognizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489860412EE2DBD003D4751 /* UISwipeGestureRecognizer.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1489860712EE2DBD003D4751 /* UISwipeGestureRecognizer.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489860512EE2DBD003D4751 /* UISwipeGestureRecognizer.m */; }; 1489860A12EE2DDC003D4751 /* UIPanGestureRecognizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1489860812EE2DDC003D4751 /* UIPanGestureRecognizer.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1489860B12EE2DDC003D4751 /* UIPanGestureRecognizer.m in Sources */ = {isa = PBXBuildFile; fileRef = 1489860912EE2DDC003D4751 /* UIPanGestureRecognizer.m */; }; 148DEE95156E945800E7B8DE /* add@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 148DEE88156E945800E7B8DE /* add@2x.png */; }; 148DEE96156E945800E7B8DE /* back-highlighted@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 148DEE89156E945800E7B8DE /* back-highlighted@2x.png */; }; 148DEE97156E945800E7B8DE /* back@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 148DEE8A156E945800E7B8DE /* back@2x.png */; }; 148DEE98156E945800E7B8DE /* background@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 148DEE8B156E945800E7B8DE /* background@2x.png */; }; 148DEE99156E945800E7B8DE /* highlighted@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 148DEE8C156E945800E7B8DE /* highlighted@2x.png */; }; 148DEE9A156E945800E7B8DE /* normal@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 148DEE8D156E945800E7B8DE /* normal@2x.png */; }; 148DEE9B156E945800E7B8DE /* grabber@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 148DEE8E156E945800E7B8DE /* grabber@2x.png */; }; 148DEE9C156E945800E7B8DE /* background.png in Resources */ = {isa = PBXBuildFile; fileRef = 148DEE8F156E945800E7B8DE /* background.png */; }; 148DEE9D156E945800E7B8DE /* background@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 148DEE90156E945800E7B8DE /* background@2x.png */; }; 148DEE9E156E945800E7B8DE /* item.png in Resources */ = {isa = PBXBuildFile; fileRef = 148DEE91156E945800E7B8DE /* item.png */; }; 148DEE9F156E945800E7B8DE /* item@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 148DEE92156E945800E7B8DE /* item@2x.png */; }; 148DEEA0156E945800E7B8DE /* button-highlighted@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 148DEE93156E945800E7B8DE /* button-highlighted@2x.png */; }; 148DEEA1156E945800E7B8DE /* button@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 148DEE94156E945800E7B8DE /* button@2x.png */; }; 1490AFE01219C31C00774286 /* UIPopoverController+UIPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1490AFDE1219C31C00774286 /* UIPopoverController+UIPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 149148BC12EE45ED00F7C34E /* UIGestureRecognizerSubclass.h in Headers */ = {isa = PBXBuildFile; fileRef = 149148BA12EE45ED00F7C34E /* UIGestureRecognizerSubclass.h */; settings = {ATTRIBUTES = (Public, ); }; }; 14A726D21213303400648C9B /* UIApplication+UIPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 14A726AF1213303400648C9B /* UIApplication+UIPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 14A726D41213303400648C9B /* UIControl+UIPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 14A726B11213303400648C9B /* UIControl+UIPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 14A726D71213303400648C9B /* UIImage+UIPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 14A726B41213303400648C9B /* UIImage+UIPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 14A726D81213303400648C9B /* UIImageView+UIPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 14A726B51213303400648C9B /* UIImageView+UIPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 14A726DA1213303400648C9B /* UIScreen+UIPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 14A726B71213303400648C9B /* UIScreen+UIPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 14A726DC1213303400648C9B /* UITableViewCell+UIPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 14A726B91213303400648C9B /* UITableViewCell+UIPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 14A726DD1213303400648C9B /* UITouch+UIPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 14A726BA1213303400648C9B /* UITouch+UIPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 14A726DE1213303400648C9B /* UIView+UIPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 14A726BB1213303400648C9B /* UIView+UIPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 14A726DF1213303400648C9B /* UIViewController+UIPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 14A726BC1213303400648C9B /* UIViewController+UIPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 14A726E01213303400648C9B /* UIWindow+UIPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 14A726BD1213303400648C9B /* UIWindow+UIPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 14BF16DB12E621EB007DAA01 /* UIViewBlockAnimationDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 14BF16D912E621EB007DAA01 /* UIViewBlockAnimationDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 14BF16DC12E621EB007DAA01 /* UIViewBlockAnimationDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 14BF16DA12E621EB007DAA01 /* UIViewBlockAnimationDelegate.m */; }; 14C0715E13CF5A2400B76E35 /* UIAction.h in Headers */ = {isa = PBXBuildFile; fileRef = 14C0715C13CF5A2300B76E35 /* UIAction.h */; settings = {ATTRIBUTES = (Private, ); }; }; 14C0715F13CF5A2400B76E35 /* UIAction.m in Sources */ = {isa = PBXBuildFile; fileRef = 14C0715D13CF5A2300B76E35 /* UIAction.m */; }; 14C0716213CF66B800B76E35 /* UIScrollWheelGestureRecognizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 14C0716013CF66B600B76E35 /* UIScrollWheelGestureRecognizer.h */; settings = {ATTRIBUTES = (Public, ); }; }; 14C0716313CF66B800B76E35 /* UIScrollWheelGestureRecognizer.m in Sources */ = {isa = PBXBuildFile; fileRef = 14C0716113CF66B700B76E35 /* UIScrollWheelGestureRecognizer.m */; }; 14CB384512689907003334AD /* UIPopoverNSWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 14CB384312689907003334AD /* UIPopoverNSWindow.h */; settings = {ATTRIBUTES = (Private, ); }; }; 14CB384612689907003334AD /* UIPopoverNSWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 14CB384412689907003334AD /* UIPopoverNSWindow.m */; }; 14CB384912689949003334AD /* UIPopoverOverlayNSView.h in Headers */ = {isa = PBXBuildFile; fileRef = 14CB384712689949003334AD /* UIPopoverOverlayNSView.h */; settings = {ATTRIBUTES = (Private, ); }; }; 14CB384A12689949003334AD /* UIPopoverOverlayNSView.m in Sources */ = {isa = PBXBuildFile; fileRef = 14CB384812689949003334AD /* UIPopoverOverlayNSView.m */; }; 14CC840611EFA8AF005988CC /* UIRoundedRectButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 14CC839011EFA8AF005988CC /* UIRoundedRectButton.h */; settings = {ATTRIBUTES = (Public, ); }; }; 14CC840711EFA8AF005988CC /* UIRoundedRectButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 14CC839111EFA8AF005988CC /* UIRoundedRectButton.m */; }; 14CC843511EFA8BA005988CC /* highlighted.png in Resources */ = {isa = PBXBuildFile; fileRef = 14CC842D11EFA8BA005988CC /* highlighted.png */; }; 14CC843611EFA8BA005988CC /* normal.png in Resources */ = {isa = PBXBuildFile; fileRef = 14CC842E11EFA8BA005988CC /* normal.png */; }; 14CC843711EFA8BA005988CC /* grabber.png in Resources */ = {isa = PBXBuildFile; fileRef = 14CC842F11EFA8BA005988CC /* grabber.png */; }; 14CC844111EFA901005988CC /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 14CC844011EFA901005988CC /* QuartzCore.framework */; }; 14CC844511EFA91A005988CC /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 14CC844411EFA91A005988CC /* SystemConfiguration.framework */; }; 14D796381540A5DA00C02139 /* UIAppearanceProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 14D796361540A5DA00C02139 /* UIAppearanceProperty.h */; settings = {ATTRIBUTES = (Private, ); }; }; 14D796391540A5DA00C02139 /* UIAppearanceProperty.m in Sources */ = {isa = PBXBuildFile; fileRef = 14D796371540A5DA00C02139 /* UIAppearanceProperty.m */; }; 14D8D941135DE90A00FE639A /* UIInputController.h in Headers */ = {isa = PBXBuildFile; fileRef = 14D8D93F135DE90A00FE639A /* UIInputController.h */; settings = {ATTRIBUTES = (Private, ); }; }; 14D8D942135DE90A00FE639A /* UIInputController.m in Sources */ = {isa = PBXBuildFile; fileRef = 14D8D940135DE90A00FE639A /* UIInputController.m */; }; 14DD1C281289B3C900DCF231 /* UIImage+UIPrivate.m in Sources */ = {isa = PBXBuildFile; fileRef = 14DD1C271289B3C900DCF231 /* UIImage+UIPrivate.m */; }; 14DD1C361289B4D500DCF231 /* button-highlighted.png in Resources */ = {isa = PBXBuildFile; fileRef = 14DD1C341289B4D500DCF231 /* button-highlighted.png */; }; 14DD1C371289B4D500DCF231 /* button.png in Resources */ = {isa = PBXBuildFile; fileRef = 14DD1C351289B4D500DCF231 /* button.png */; }; 14E20663156FE88D0040349D /* UIImageAppKitIntegration.m in Sources */ = {isa = PBXBuildFile; fileRef = 14E20662156FE88D0040349D /* UIImageAppKitIntegration.m */; }; 14EEF76712DF67CF00EB7D95 /* UIEvent+UIPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 14EEF76512DF67CF00EB7D95 /* UIEvent+UIPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 14EEF7A912DF6D9C00EB7D95 /* UIKey+UIPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 14EEF7A812DF6D9C00EB7D95 /* UIKey+UIPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 14F0BC0D1288A67F00BA54F9 /* add.png in Resources */ = {isa = PBXBuildFile; fileRef = 14F0BC0B1288A67F00BA54F9 /* add.png */; }; 14F0BC0E1288A67F00BA54F9 /* reply.png in Resources */ = {isa = PBXBuildFile; fileRef = 14F0BC0C1288A67F00BA54F9 /* reply.png */; }; 14F56F3D12664D350045EC82 /* arrow-bottom.png in Resources */ = {isa = PBXBuildFile; fileRef = 14F56F3812664D350045EC82 /* arrow-bottom.png */; }; 14F56F3E12664D350045EC82 /* arrow-left.png in Resources */ = {isa = PBXBuildFile; fileRef = 14F56F3912664D350045EC82 /* arrow-left.png */; }; 14F56F3F12664D350045EC82 /* arrow-right.png in Resources */ = {isa = PBXBuildFile; fileRef = 14F56F3A12664D350045EC82 /* arrow-right.png */; }; 14F56F4012664D350045EC82 /* arrow-top.png in Resources */ = {isa = PBXBuildFile; fileRef = 14F56F3B12664D350045EC82 /* arrow-top.png */; }; 14F56F4112664D350045EC82 /* background.png in Resources */ = {isa = PBXBuildFile; fileRef = 14F56F3C12664D350045EC82 /* background.png */; }; 14F56F4412664D430045EC82 /* UIPopoverView.h in Headers */ = {isa = PBXBuildFile; fileRef = 14F56F4212664D430045EC82 /* UIPopoverView.h */; settings = {ATTRIBUTES = (Private, ); }; }; 14F56F4512664D430045EC82 /* UIPopoverView.m in Sources */ = {isa = PBXBuildFile; fileRef = 14F56F4312664D430045EC82 /* UIPopoverView.m */; }; 14FA8C5F121DA4A000C4264B /* UINinePartImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 14FA8C47121DA4A000C4264B /* UINinePartImage.h */; settings = {ATTRIBUTES = (Private, ); }; }; 14FA8C60121DA4A000C4264B /* UINinePartImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 14FA8C48121DA4A000C4264B /* UINinePartImage.m */; }; 14FA8C67121DA4A000C4264B /* UIScroller.h in Headers */ = {isa = PBXBuildFile; fileRef = 14FA8C4F121DA4A000C4264B /* UIScroller.h */; settings = {ATTRIBUTES = (Private, ); }; }; 14FA8C68121DA4A000C4264B /* UIScroller.m in Sources */ = {isa = PBXBuildFile; fileRef = 14FA8C50121DA4A000C4264B /* UIScroller.m */; }; 14FA8C69121DA4A000C4264B /* UITableViewCellSeparator.h in Headers */ = {isa = PBXBuildFile; fileRef = 14FA8C51121DA4A000C4264B /* UITableViewCellSeparator.h */; settings = {ATTRIBUTES = (Private, ); }; }; 14FA8C6A121DA4A000C4264B /* UITableViewCellSeparator.m in Sources */ = {isa = PBXBuildFile; fileRef = 14FA8C52121DA4A000C4264B /* UITableViewCellSeparator.m */; }; 14FA8C6B121DA4A000C4264B /* UITableViewSection.h in Headers */ = {isa = PBXBuildFile; fileRef = 14FA8C53121DA4A000C4264B /* UITableViewSection.h */; settings = {ATTRIBUTES = (Private, ); }; }; 14FA8C6C121DA4A000C4264B /* UITableViewSection.m in Sources */ = {isa = PBXBuildFile; fileRef = 14FA8C54121DA4A000C4264B /* UITableViewSection.m */; }; 14FA8C6D121DA4A000C4264B /* UITableViewSectionLabel.h in Headers */ = {isa = PBXBuildFile; fileRef = 14FA8C55121DA4A000C4264B /* UITableViewSectionLabel.h */; settings = {ATTRIBUTES = (Private, ); }; }; 14FA8C6E121DA4A000C4264B /* UITableViewSectionLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 14FA8C56121DA4A000C4264B /* UITableViewSectionLabel.m */; }; 14FA8C6F121DA4A000C4264B /* UIThreePartImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 14FA8C57121DA4A000C4264B /* UIThreePartImage.h */; settings = {ATTRIBUTES = (Private, ); }; }; 14FA8C70121DA4A000C4264B /* UIThreePartImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 14FA8C58121DA4A000C4264B /* UIThreePartImage.m */; }; 14FA8C71121DA4A000C4264B /* UIViewAnimationGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = 14FA8C59121DA4A000C4264B /* UIViewAnimationGroup.h */; settings = {ATTRIBUTES = (Private, ); }; }; 14FA8C72121DA4A000C4264B /* UIViewAnimationGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = 14FA8C5A121DA4A000C4264B /* UIViewAnimationGroup.m */; }; 14FA8C73121DA4A000C4264B /* UIViewLayoutManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 14FA8C5B121DA4A000C4264B /* UIViewLayoutManager.h */; settings = {ATTRIBUTES = (Private, ); }; }; 14FA8C74121DA4A000C4264B /* UIViewLayoutManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 14FA8C5C121DA4A000C4264B /* UIViewLayoutManager.m */; }; 14FDE99C153C9A1800A2D499 /* UIAppearance.h in Headers */ = {isa = PBXBuildFile; fileRef = 14FDE99A153C9A1800A2D499 /* UIAppearance.h */; settings = {ATTRIBUTES = (Public, ); }; }; 14FDE9A5153CAECA00A2D499 /* UIAppearanceProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 14FDE9A3153CAECA00A2D499 /* UIAppearanceProxy.h */; settings = {ATTRIBUTES = (Private, ); }; }; 14FDE9A6153CAECA00A2D499 /* UIAppearanceProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 14FDE9A4153CAECA00A2D499 /* UIAppearanceProxy.m */; }; 38615C78133A81B900841EEA /* UIFont+UIPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 38615C77133A81B900841EEA /* UIFont+UIPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 38E523B11339680400E041B3 /* UINavigationItem+UIPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 38E523AF1339680400E041B3 /* UINavigationItem+UIPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 38E523B513396B5B00E041B3 /* UINavigationBar+UIPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 38E523B413396B5B00E041B3 /* UINavigationBar+UIPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 537472D5133ADD4B00EBD5EA /* UIInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 537472D3133ADD4B00EBD5EA /* UIInterface.h */; settings = {ATTRIBUTES = (Public, ); }; }; 537472D6133ADD4B00EBD5EA /* UIInterface.m in Sources */ = {isa = PBXBuildFile; fileRef = 537472D4133ADD4B00EBD5EA /* UIInterface.m */; }; 7011107C133BE0F400C86512 /* UIDatePicker.h in Headers */ = {isa = PBXBuildFile; fileRef = 7011107A133BE0F300C86512 /* UIDatePicker.h */; settings = {ATTRIBUTES = (Public, ); }; }; 7011107D133BE0F400C86512 /* UIDatePicker.m in Sources */ = {isa = PBXBuildFile; fileRef = 7011107B133BE0F300C86512 /* UIDatePicker.m */; }; 7806ED2A133A1D7500273BC6 /* UITabBar.h in Headers */ = {isa = PBXBuildFile; fileRef = 7806ED28133A1D7500273BC6 /* UITabBar.h */; settings = {ATTRIBUTES = (Public, ); }; }; 7806ED2B133A1D7500273BC6 /* UITabBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 7806ED29133A1D7500273BC6 /* UITabBar.m */; }; 78CB48AC133A9C51008636DA /* UISearchBar.h in Headers */ = {isa = PBXBuildFile; fileRef = 78CB48AA133A9C51008636DA /* UISearchBar.h */; settings = {ATTRIBUTES = (Public, ); }; }; 78CB48AD133A9C51008636DA /* UISearchBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 78CB48AB133A9C51008636DA /* UISearchBar.m */; }; 78CB48B0133AA536008636DA /* UITabBarItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 78CB48AE133AA535008636DA /* UITabBarItem.h */; settings = {ATTRIBUTES = (Public, ); }; }; 78CB48B1133AA536008636DA /* UITabBarItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 78CB48AF133AA535008636DA /* UITabBarItem.m */; }; 78CB48B4133AA8AF008636DA /* UISegmentedControl.h in Headers */ = {isa = PBXBuildFile; fileRef = 78CB48B2133AA8AF008636DA /* UISegmentedControl.h */; settings = {ATTRIBUTES = (Public, ); }; }; 78CB48B5133AA8AF008636DA /* UISegmentedControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 78CB48B3133AA8AF008636DA /* UISegmentedControl.m */; }; 78CB48BC133AADD0008636DA /* UIPickerView.h in Headers */ = {isa = PBXBuildFile; fileRef = 78CB48BA133AADCF008636DA /* UIPickerView.h */; settings = {ATTRIBUTES = (Public, ); }; }; 78CB48BD133AADD0008636DA /* UIPickerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 78CB48BB133AADD0008636DA /* UIPickerView.m */; }; 78CB48D9133AB922008636DA /* UISlider.h in Headers */ = {isa = PBXBuildFile; fileRef = 78CB48D7133AB91E008636DA /* UISlider.h */; settings = {ATTRIBUTES = (Public, ); }; }; 78CB48DA133AB922008636DA /* UISlider.m in Sources */ = {isa = PBXBuildFile; fileRef = 78CB48D8133AB920008636DA /* UISlider.m */; }; 78D533DD133A9434006F17CA /* UISearchDisplayController.h in Headers */ = {isa = PBXBuildFile; fileRef = 78D533DB133A9434006F17CA /* UISearchDisplayController.h */; settings = {ATTRIBUTES = (Public, ); }; }; 78D533DE133A9434006F17CA /* UISearchDisplayController.m in Sources */ = {isa = PBXBuildFile; fileRef = 78D533DC133A9434006F17CA /* UISearchDisplayController.m */; }; 8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 0867D69BFE84028FC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 0867D6A5FE840307C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 1413D20C13D72A06004D77E9 /* UIScrollViewAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIScrollViewAnimation.h; sourceTree = ""; }; 1413D20D13D72A06004D77E9 /* UIScrollViewAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIScrollViewAnimation.m; sourceTree = ""; }; 1413D20E13D72A06004D77E9 /* UIScrollViewAnimationDeceleration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIScrollViewAnimationDeceleration.h; sourceTree = ""; }; 1413D20F13D72A06004D77E9 /* UIScrollViewAnimationDeceleration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIScrollViewAnimationDeceleration.m; sourceTree = ""; }; 1413D21013D72A06004D77E9 /* UIScrollViewAnimationScroll.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIScrollViewAnimationScroll.h; sourceTree = ""; }; 1413D21113D72A06004D77E9 /* UIScrollViewAnimationScroll.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIScrollViewAnimationScroll.m; sourceTree = ""; }; 1426A01E15701598004C2C9A /* reply@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = " reply@2x.png"; path = "Resources/ reply@2x.png"; sourceTree = ""; }; 1426A01F15701598004C2C9A /* arrow-bottom@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = " arrow-bottom@2x.png"; path = "Resources/ arrow-bottom@2x.png"; sourceTree = ""; }; 1426A02015701598004C2C9A /* arrow-left@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = " arrow-left@2x.png"; path = "Resources/ arrow-left@2x.png"; sourceTree = ""; }; 1426A02115701598004C2C9A /* arrow-right@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = " arrow-right@2x.png"; path = "Resources/ arrow-right@2x.png"; sourceTree = ""; }; 1426A02215701598004C2C9A /* arrow-top@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = " arrow-top@2x.png"; path = "Resources/ arrow-top@2x.png"; sourceTree = ""; }; 1426FFDB129ADEA300BD31E5 /* UIControlAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIControlAction.h; sourceTree = ""; }; 1426FFDC129ADEA300BD31E5 /* UIControlAction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIControlAction.m; sourceTree = ""; }; 144156D91284A22200532FE2 /* UIToolbarButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIToolbarButton.h; sourceTree = ""; }; 144156DA1284A22200532FE2 /* UIToolbarButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIToolbarButton.m; sourceTree = ""; }; 1443B06A13E06081001D7EC1 /* UIBackgroundTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIBackgroundTask.h; sourceTree = ""; }; 1443B06B13E06081001D7EC1 /* UIBackgroundTask.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIBackgroundTask.m; sourceTree = ""; }; 1443DF23121F0D5A00E07C4A /* UIScreenMode+UIPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIScreenMode+UIPrivate.h"; sourceTree = ""; }; 1444318D137D7FEE00B81304 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; }; 145335631226F03E0005644F /* UITextLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UITextLayer.h; sourceTree = ""; }; 145335641226F03E0005644F /* UITextLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UITextLayer.m; sourceTree = ""; }; 145335671226F1F90005644F /* UIBulletGlyphGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIBulletGlyphGenerator.h; sourceTree = ""; }; 145335681226F1F90005644F /* UIBulletGlyphGenerator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIBulletGlyphGenerator.m; sourceTree = ""; }; 1453356F1226F2720005644F /* UICustomNSTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UICustomNSTextView.h; sourceTree = ""; }; 145335701226F2720005644F /* UICustomNSTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UICustomNSTextView.m; sourceTree = ""; }; 145335831226F3490005644F /* UICustomNSClipView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UICustomNSClipView.h; sourceTree = ""; }; 145335841226F3490005644F /* UICustomNSClipView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UICustomNSClipView.m; sourceTree = ""; }; 14541DB01360D6F300C1006D /* UIPhotosAlbum.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIPhotosAlbum.h; sourceTree = ""; }; 14541DB11360D6F300C1006D /* UIPhotosAlbum.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIPhotosAlbum.m; sourceTree = ""; }; 145576221541DC560029EF4D /* UIAppearanceInstance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIAppearanceInstance.h; sourceTree = ""; }; 145576251541DC830029EF4D /* UIAppearanceInstance.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIAppearanceInstance.m; sourceTree = ""; }; 1457DD3D128DDE610057A7F9 /* UITransitionView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UITransitionView.h; sourceTree = ""; }; 1457DD3E128DDE610057A7F9 /* UITransitionView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UITransitionView.m; sourceTree = ""; }; 145BE31B15754F2400C41D70 /* UIColorRep.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIColorRep.h; sourceTree = ""; }; 145BE31C15754F2400C41D70 /* UIColorRep.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIColorRep.m; sourceTree = ""; }; 145BE3201575523000C41D70 /* UIColor+UIPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIColor+UIPrivate.h"; sourceTree = ""; }; 1464960711FF7AE500ECEC7A /* back-highlighted.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = " back-highlighted.png"; path = "Resources/ back-highlighted.png"; sourceTree = ""; }; 1464960811FF7AE500ECEC7A /* back.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = " back.png"; path = "Resources/ back.png"; sourceTree = ""; }; 14711392156FC83F00251B2E /* UIImageRep.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIImageRep.h; sourceTree = ""; }; 14711393156FC83F00251B2E /* UIImageRep.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIImageRep.m; sourceTree = ""; }; 14805D3F12A6B0E80080C4BA /* UINSClipView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UINSClipView.h; sourceTree = ""; }; 14805D4012A6B0E80080C4BA /* UINSClipView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UINSClipView.m; sourceTree = ""; }; 14805F5812A6E2AE0080C4BA /* UIScrollView+UIPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIScrollView+UIPrivate.h"; sourceTree = ""; }; 1480633512A851230080C4BA /* QTKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QTKit.framework; path = System/Library/Frameworks/QTKit.framework; sourceTree = SDKROOT; }; 1480633712A851230080C4BA /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; 148984A312EE278D003D4751 /* UIGestureRecognizer+UIPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIGestureRecognizer+UIPrivate.h"; sourceTree = ""; }; 148984E412EE2CFE003D4751 /* AppKitIntegration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppKitIntegration.h; sourceTree = ""; }; 148984E512EE2CFE003D4751 /* NSIndexPath+UITableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSIndexPath+UITableView.h"; sourceTree = ""; }; 148984E612EE2CFE003D4751 /* NSIndexPath+UITableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSIndexPath+UITableView.m"; sourceTree = ""; }; 148984E712EE2CFE003D4751 /* UIAcceleration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIAcceleration.h; sourceTree = ""; }; 148984E812EE2CFE003D4751 /* UIAcceleration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIAcceleration.m; sourceTree = ""; }; 148984E912EE2CFE003D4751 /* UIAccelerometer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIAccelerometer.h; sourceTree = ""; }; 148984EA12EE2CFE003D4751 /* UIAccelerometer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIAccelerometer.m; sourceTree = ""; }; 148984EB12EE2CFE003D4751 /* UIAccessibility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIAccessibility.h; sourceTree = ""; }; 148984EC12EE2CFE003D4751 /* UIAccessibility.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIAccessibility.m; sourceTree = ""; }; 148984ED12EE2CFE003D4751 /* UIAccessibilityElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIAccessibilityElement.h; sourceTree = ""; }; 148984EE12EE2CFE003D4751 /* UIAccessibilityElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIAccessibilityElement.m; sourceTree = ""; }; 148984EF12EE2CFE003D4751 /* UIActionSheet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIActionSheet.h; sourceTree = ""; }; 148984F012EE2CFE003D4751 /* UIActionSheet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIActionSheet.m; sourceTree = ""; }; 148984F112EE2CFE003D4751 /* UIActionSheetAppKitIntegration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIActionSheetAppKitIntegration.h; sourceTree = ""; }; 148984F212EE2CFE003D4751 /* UIActivityIndicatorView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIActivityIndicatorView.h; sourceTree = ""; }; 148984F312EE2CFE003D4751 /* UIActivityIndicatorView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIActivityIndicatorView.m; sourceTree = ""; }; 148984F412EE2CFE003D4751 /* UIAlertView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIAlertView.h; sourceTree = ""; }; 148984F512EE2CFE003D4751 /* UIAlertView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIAlertView.m; sourceTree = ""; }; 148984F612EE2CFE003D4751 /* UIApplication.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIApplication.h; sourceTree = ""; }; 148984F712EE2CFE003D4751 /* UIApplication.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIApplication.m; sourceTree = ""; }; 148984F812EE2CFE003D4751 /* UIApplicationAppKitIntegration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIApplicationAppKitIntegration.h; sourceTree = ""; }; 148984F912EE2CFE003D4751 /* UIApplicationDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIApplicationDelegate.h; sourceTree = ""; }; 148984FA12EE2CFE003D4751 /* UIBarButtonItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIBarButtonItem.h; sourceTree = ""; }; 148984FB12EE2CFE003D4751 /* UIBarButtonItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIBarButtonItem.m; sourceTree = ""; }; 148984FC12EE2CFE003D4751 /* UIBarItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIBarItem.h; sourceTree = ""; }; 148984FD12EE2CFE003D4751 /* UIBarItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIBarItem.m; sourceTree = ""; }; 148984FE12EE2CFE003D4751 /* UIBezierPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIBezierPath.h; sourceTree = ""; }; 148984FF12EE2CFE003D4751 /* UIBezierPath.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIBezierPath.m; sourceTree = ""; }; 1489850012EE2CFE003D4751 /* UIButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIButton.h; sourceTree = ""; }; 1489850112EE2CFE003D4751 /* UIButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIButton.m; sourceTree = ""; }; 1489850212EE2CFE003D4751 /* UIColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIColor.h; sourceTree = ""; }; 1489850312EE2CFE003D4751 /* UIColor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIColor.m; sourceTree = ""; }; 1489850412EE2CFE003D4751 /* UIColorAppKitIntegration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIColorAppKitIntegration.h; sourceTree = ""; }; 1489850512EE2CFE003D4751 /* UIControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIControl.h; sourceTree = ""; }; 1489850612EE2CFE003D4751 /* UIControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIControl.m; sourceTree = ""; }; 1489850712EE2CFE003D4751 /* UIDataDetectors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIDataDetectors.h; sourceTree = ""; }; 1489850812EE2CFE003D4751 /* UIDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIDevice.h; sourceTree = ""; }; 1489850912EE2CFE003D4751 /* UIDevice.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIDevice.m; sourceTree = ""; }; 1489850A12EE2CFE003D4751 /* UIEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIEvent.h; sourceTree = ""; }; 1489850B12EE2CFE003D4751 /* UIEvent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIEvent.m; sourceTree = ""; }; 1489850C12EE2CFE003D4751 /* UIFont.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIFont.h; sourceTree = ""; }; 1489850D12EE2CFE003D4751 /* UIFont.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIFont.m; sourceTree = ""; }; 1489850E12EE2CFE003D4751 /* UIFontAppKitIntegration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIFontAppKitIntegration.h; sourceTree = ""; }; 1489850F12EE2CFE003D4751 /* UIGeometry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIGeometry.h; sourceTree = ""; }; 1489851012EE2CFE003D4751 /* UIGeometry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIGeometry.m; sourceTree = ""; }; 1489851112EE2CFE003D4751 /* UIGestureRecognizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIGestureRecognizer.h; sourceTree = ""; }; 1489851212EE2CFE003D4751 /* UIGestureRecognizer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIGestureRecognizer.m; sourceTree = ""; }; 1489851312EE2CFE003D4751 /* UIGraphics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIGraphics.h; sourceTree = ""; }; 1489851412EE2CFE003D4751 /* UIGraphics.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIGraphics.m; sourceTree = ""; }; 1489851512EE2CFE003D4751 /* UIImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIImage.h; sourceTree = ""; }; 1489851612EE2CFE003D4751 /* UIImage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIImage.m; sourceTree = ""; }; 1489851712EE2CFE003D4751 /* UIImageAppKitIntegration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIImageAppKitIntegration.h; sourceTree = ""; }; 1489851812EE2CFE003D4751 /* UIImagePickerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIImagePickerController.h; sourceTree = ""; }; 1489851912EE2CFE003D4751 /* UIImagePickerController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIImagePickerController.m; sourceTree = ""; }; 1489851A12EE2CFE003D4751 /* UIImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIImageView.h; sourceTree = ""; }; 1489851B12EE2CFE003D4751 /* UIImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIImageView.m; sourceTree = ""; }; 1489851C12EE2CFE003D4751 /* UIKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIKey.h; sourceTree = ""; }; 1489851D12EE2CFE003D4751 /* UIKey.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIKey.m; sourceTree = ""; }; 1489851E12EE2CFE003D4751 /* UIKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIKit.h; sourceTree = ""; }; 1489851F12EE2CFE003D4751 /* UIKitView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIKitView.h; sourceTree = ""; }; 1489852012EE2CFE003D4751 /* UIKitView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIKitView.m; sourceTree = ""; }; 1489852112EE2CFE003D4751 /* UILabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UILabel.h; sourceTree = ""; }; 1489852212EE2CFE003D4751 /* UILabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UILabel.m; sourceTree = ""; }; 1489852312EE2CFE003D4751 /* UILongPressGestureRecognizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UILongPressGestureRecognizer.h; sourceTree = ""; }; 1489852412EE2CFE003D4751 /* UILongPressGestureRecognizer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UILongPressGestureRecognizer.m; sourceTree = ""; }; 1489852512EE2CFE003D4751 /* UIMenuController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIMenuController.h; sourceTree = ""; }; 1489852612EE2CFE003D4751 /* UIMenuController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIMenuController.m; sourceTree = ""; }; 1489852712EE2CFE003D4751 /* UIMenuItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIMenuItem.h; sourceTree = ""; }; 1489852812EE2CFE003D4751 /* UIMenuItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIMenuItem.m; sourceTree = ""; }; 1489852912EE2CFE003D4751 /* UINavigationBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UINavigationBar.h; sourceTree = ""; }; 1489852A12EE2CFE003D4751 /* UINavigationBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UINavigationBar.m; sourceTree = ""; }; 1489852B12EE2CFE003D4751 /* UINavigationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UINavigationController.h; sourceTree = ""; }; 1489852C12EE2CFE003D4751 /* UINavigationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UINavigationController.m; sourceTree = ""; }; 1489852D12EE2CFE003D4751 /* UINavigationItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UINavigationItem.h; sourceTree = ""; }; 1489852E12EE2CFE003D4751 /* UINavigationItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UINavigationItem.m; sourceTree = ""; }; 1489852F12EE2CFE003D4751 /* UINibLoading.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UINibLoading.h; sourceTree = ""; }; 1489853012EE2CFE003D4751 /* UINibLoading.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UINibLoading.m; sourceTree = ""; }; 1489853112EE2CFE003D4751 /* UIPageControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIPageControl.h; sourceTree = ""; }; 1489853212EE2CFE003D4751 /* UIPageControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIPageControl.m; sourceTree = ""; }; 1489853312EE2CFE003D4751 /* UIPasteboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIPasteboard.h; sourceTree = ""; }; 1489853412EE2CFE003D4751 /* UIPasteboard.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = UIPasteboard.m; sourceTree = ""; tabWidth = 4; }; 1489853512EE2CFE003D4751 /* UIPinchGestureRecognizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIPinchGestureRecognizer.h; sourceTree = ""; }; 1489853612EE2CFE003D4751 /* UIPinchGestureRecognizer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIPinchGestureRecognizer.m; sourceTree = ""; }; 1489853712EE2CFE003D4751 /* UIPopoverController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIPopoverController.h; sourceTree = ""; }; 1489853812EE2CFE003D4751 /* UIPopoverController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIPopoverController.m; sourceTree = ""; }; 1489853912EE2CFE003D4751 /* UIProgressView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIProgressView.h; sourceTree = ""; }; 1489853A12EE2CFE003D4751 /* UIProgressView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIProgressView.m; sourceTree = ""; }; 1489853B12EE2CFE003D4751 /* UIResponder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIResponder.h; sourceTree = ""; }; 1489853C12EE2CFE003D4751 /* UIResponder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIResponder.m; sourceTree = ""; }; 1489853D12EE2CFE003D4751 /* UIResponderAppKitIntegration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIResponderAppKitIntegration.h; sourceTree = ""; }; 1489853E12EE2CFE003D4751 /* UIResponderAppKitIntegration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIResponderAppKitIntegration.m; sourceTree = ""; }; 1489853F12EE2CFE003D4751 /* UIScreen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIScreen.h; sourceTree = ""; }; 1489854012EE2CFE003D4751 /* UIScreen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIScreen.m; sourceTree = ""; }; 1489854112EE2CFE003D4751 /* UIScreenAppKitIntegration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIScreenAppKitIntegration.h; sourceTree = ""; }; 1489854212EE2CFE003D4751 /* UIScreenAppKitIntegration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIScreenAppKitIntegration.m; sourceTree = ""; }; 1489854312EE2CFE003D4751 /* UIScreenMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIScreenMode.h; sourceTree = ""; }; 1489854412EE2CFE003D4751 /* UIScreenMode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIScreenMode.m; sourceTree = ""; }; 1489854512EE2CFE003D4751 /* UIScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIScrollView.h; sourceTree = ""; }; 1489854612EE2CFE003D4751 /* UIScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIScrollView.m; sourceTree = ""; }; 1489854712EE2CFE003D4751 /* UISplitViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UISplitViewController.h; sourceTree = ""; }; 1489854812EE2CFE003D4751 /* UISplitViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UISplitViewController.m; sourceTree = ""; }; 1489854912EE2CFE003D4751 /* UIStringDrawing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIStringDrawing.h; sourceTree = ""; }; 1489854A12EE2CFE003D4751 /* UIStringDrawing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIStringDrawing.m; sourceTree = ""; }; 1489854B12EE2CFE003D4751 /* UISwitch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UISwitch.h; sourceTree = ""; }; 1489854C12EE2CFE003D4751 /* UISwitch.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UISwitch.m; sourceTree = ""; }; 1489854D12EE2CFE003D4751 /* UITabBarController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UITabBarController.h; sourceTree = ""; }; 1489854E12EE2CFE003D4751 /* UITabBarController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UITabBarController.m; sourceTree = ""; }; 1489854F12EE2CFE003D4751 /* UITableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UITableView.h; sourceTree = ""; }; 1489855012EE2CFE003D4751 /* UITableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UITableView.m; sourceTree = ""; }; 1489855112EE2CFE003D4751 /* UITableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UITableViewCell.h; sourceTree = ""; }; 1489855212EE2CFE003D4751 /* UITableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UITableViewCell.m; sourceTree = ""; }; 1489855312EE2CFE003D4751 /* UITableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UITableViewController.h; sourceTree = ""; }; 1489855412EE2CFE003D4751 /* UITableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UITableViewController.m; sourceTree = ""; }; 1489855512EE2CFE003D4751 /* UITapGestureRecognizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UITapGestureRecognizer.h; sourceTree = ""; }; 1489855612EE2CFE003D4751 /* UITapGestureRecognizer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UITapGestureRecognizer.m; sourceTree = ""; }; 1489855712EE2CFE003D4751 /* UITextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UITextField.h; sourceTree = ""; }; 1489855812EE2CFE003D4751 /* UITextField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UITextField.m; sourceTree = ""; }; 1489855912EE2CFE003D4751 /* UITextInputTraits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UITextInputTraits.h; sourceTree = ""; }; 1489855A12EE2CFE003D4751 /* UITextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UITextView.h; sourceTree = ""; }; 1489855B12EE2CFE003D4751 /* UITextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UITextView.m; sourceTree = ""; }; 1489855C12EE2CFE003D4751 /* UIToolbar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIToolbar.h; sourceTree = ""; }; 1489855D12EE2CFE003D4751 /* UIToolbar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIToolbar.m; sourceTree = ""; }; 1489855E12EE2CFE003D4751 /* UITouch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UITouch.h; sourceTree = ""; }; 1489855F12EE2CFE003D4751 /* UITouch.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UITouch.m; sourceTree = ""; }; 1489856012EE2CFE003D4751 /* UIView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIView.h; sourceTree = ""; }; 1489856112EE2CFE003D4751 /* UIView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIView.m; sourceTree = ""; }; 1489856212EE2CFE003D4751 /* UIViewAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIViewAdapter.h; sourceTree = ""; }; 1489856312EE2CFE003D4751 /* UIViewAdapter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIViewAdapter.m; sourceTree = ""; }; 1489856412EE2CFE003D4751 /* UIViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIViewController.h; sourceTree = ""; }; 1489856512EE2CFE003D4751 /* UIViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIViewController.m; sourceTree = ""; }; 1489856612EE2CFE003D4751 /* UIWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIWebView.h; sourceTree = ""; }; 1489856712EE2CFE003D4751 /* UIWebView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIWebView.m; sourceTree = ""; }; 1489856812EE2CFE003D4751 /* UIWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIWindow.h; sourceTree = ""; }; 1489856912EE2CFE003D4751 /* UIWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIWindow.m; sourceTree = ""; }; 1489860012EE2D9F003D4751 /* UIRotationGestureRecognizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIRotationGestureRecognizer.h; sourceTree = ""; }; 1489860112EE2D9F003D4751 /* UIRotationGestureRecognizer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIRotationGestureRecognizer.m; sourceTree = ""; }; 1489860412EE2DBD003D4751 /* UISwipeGestureRecognizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UISwipeGestureRecognizer.h; sourceTree = ""; }; 1489860512EE2DBD003D4751 /* UISwipeGestureRecognizer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UISwipeGestureRecognizer.m; sourceTree = ""; }; 1489860812EE2DDC003D4751 /* UIPanGestureRecognizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIPanGestureRecognizer.h; sourceTree = ""; }; 1489860912EE2DDC003D4751 /* UIPanGestureRecognizer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIPanGestureRecognizer.m; sourceTree = ""; }; 148DEE88156E945800E7B8DE /* add@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = " add@2x.png"; path = "Resources/ add@2x.png"; sourceTree = ""; }; 148DEE89156E945800E7B8DE /* back-highlighted@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = " back-highlighted@2x.png"; path = "Resources/ back-highlighted@2x.png"; sourceTree = ""; }; 148DEE8A156E945800E7B8DE /* back@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = " back@2x.png"; path = "Resources/ back@2x.png"; sourceTree = ""; }; 148DEE8B156E945800E7B8DE /* background@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = " background@2x.png"; path = "Resources/ background@2x.png"; sourceTree = ""; }; 148DEE8C156E945800E7B8DE /* highlighted@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = " highlighted@2x.png"; path = "Resources/ highlighted@2x.png"; sourceTree = ""; }; 148DEE8D156E945800E7B8DE /* normal@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = " normal@2x.png"; path = "Resources/ normal@2x.png"; sourceTree = ""; }; 148DEE8E156E945800E7B8DE /* grabber@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = " grabber@2x.png"; path = "Resources/ grabber@2x.png"; sourceTree = ""; }; 148DEE8F156E945800E7B8DE /* background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = " background.png"; path = "Resources/ background.png"; sourceTree = ""; }; 148DEE90156E945800E7B8DE /* background@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = " background@2x.png"; path = "Resources/ background@2x.png"; sourceTree = ""; }; 148DEE91156E945800E7B8DE /* item.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = " item.png"; path = "Resources/ item.png"; sourceTree = ""; }; 148DEE92156E945800E7B8DE /* item@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = " item@2x.png"; path = "Resources/ item@2x.png"; sourceTree = ""; }; 148DEE93156E945800E7B8DE /* button-highlighted@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = " button-highlighted@2x.png"; path = "Resources/ button-highlighted@2x.png"; sourceTree = ""; }; 148DEE94156E945800E7B8DE /* button@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = " button@2x.png"; path = "Resources/ button@2x.png"; sourceTree = ""; }; 1490AFDE1219C31C00774286 /* UIPopoverController+UIPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIPopoverController+UIPrivate.h"; sourceTree = ""; }; 149148BA12EE45ED00F7C34E /* UIGestureRecognizerSubclass.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIGestureRecognizerSubclass.h; sourceTree = ""; }; 14A726AF1213303400648C9B /* UIApplication+UIPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIApplication+UIPrivate.h"; sourceTree = ""; }; 14A726B11213303400648C9B /* UIControl+UIPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIControl+UIPrivate.h"; sourceTree = ""; }; 14A726B41213303400648C9B /* UIImage+UIPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+UIPrivate.h"; sourceTree = ""; }; 14A726B51213303400648C9B /* UIImageView+UIPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImageView+UIPrivate.h"; sourceTree = ""; }; 14A726B71213303400648C9B /* UIScreen+UIPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIScreen+UIPrivate.h"; sourceTree = ""; }; 14A726B91213303400648C9B /* UITableViewCell+UIPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITableViewCell+UIPrivate.h"; sourceTree = ""; }; 14A726BA1213303400648C9B /* UITouch+UIPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITouch+UIPrivate.h"; sourceTree = ""; }; 14A726BB1213303400648C9B /* UIView+UIPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+UIPrivate.h"; sourceTree = ""; }; 14A726BC1213303400648C9B /* UIViewController+UIPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIViewController+UIPrivate.h"; sourceTree = ""; }; 14A726BD1213303400648C9B /* UIWindow+UIPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIWindow+UIPrivate.h"; sourceTree = ""; }; 14BF16D912E621EB007DAA01 /* UIViewBlockAnimationDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIViewBlockAnimationDelegate.h; sourceTree = ""; }; 14BF16DA12E621EB007DAA01 /* UIViewBlockAnimationDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIViewBlockAnimationDelegate.m; sourceTree = ""; }; 14C0715C13CF5A2300B76E35 /* UIAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIAction.h; sourceTree = ""; }; 14C0715D13CF5A2300B76E35 /* UIAction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIAction.m; sourceTree = ""; }; 14C0716013CF66B600B76E35 /* UIScrollWheelGestureRecognizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIScrollWheelGestureRecognizer.h; sourceTree = ""; }; 14C0716113CF66B700B76E35 /* UIScrollWheelGestureRecognizer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIScrollWheelGestureRecognizer.m; sourceTree = ""; }; 14CB384312689907003334AD /* UIPopoverNSWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIPopoverNSWindow.h; sourceTree = ""; }; 14CB384412689907003334AD /* UIPopoverNSWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIPopoverNSWindow.m; sourceTree = ""; }; 14CB384712689949003334AD /* UIPopoverOverlayNSView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIPopoverOverlayNSView.h; sourceTree = ""; }; 14CB384812689949003334AD /* UIPopoverOverlayNSView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIPopoverOverlayNSView.m; sourceTree = ""; }; 14CC839011EFA8AF005988CC /* UIRoundedRectButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIRoundedRectButton.h; sourceTree = ""; }; 14CC839111EFA8AF005988CC /* UIRoundedRectButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIRoundedRectButton.m; sourceTree = ""; }; 14CC842D11EFA8BA005988CC /* highlighted.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = " highlighted.png"; path = "Resources/ highlighted.png"; sourceTree = ""; }; 14CC842E11EFA8BA005988CC /* normal.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = " normal.png"; path = "Resources/ normal.png"; sourceTree = ""; }; 14CC842F11EFA8BA005988CC /* grabber.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = " grabber.png"; path = "Resources/ grabber.png"; sourceTree = ""; }; 14CC844011EFA901005988CC /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 14CC844411EFA91A005988CC /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; 14D796361540A5DA00C02139 /* UIAppearanceProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIAppearanceProperty.h; sourceTree = ""; }; 14D796371540A5DA00C02139 /* UIAppearanceProperty.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIAppearanceProperty.m; sourceTree = ""; }; 14D8D93F135DE90A00FE639A /* UIInputController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIInputController.h; sourceTree = ""; }; 14D8D940135DE90A00FE639A /* UIInputController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIInputController.m; sourceTree = ""; }; 14DD1C271289B3C900DCF231 /* UIImage+UIPrivate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+UIPrivate.m"; sourceTree = ""; }; 14DD1C341289B4D500DCF231 /* button-highlighted.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = " button-highlighted.png"; path = "Resources/ button-highlighted.png"; sourceTree = ""; }; 14DD1C351289B4D500DCF231 /* button.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = " button.png"; path = "Resources/ button.png"; sourceTree = ""; }; 14E20662156FE88D0040349D /* UIImageAppKitIntegration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIImageAppKitIntegration.m; sourceTree = ""; }; 14EEF76512DF67CF00EB7D95 /* UIEvent+UIPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIEvent+UIPrivate.h"; sourceTree = ""; }; 14EEF7A812DF6D9C00EB7D95 /* UIKey+UIPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIKey+UIPrivate.h"; sourceTree = ""; }; 14F0BC0B1288A67F00BA54F9 /* add.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = " add.png"; path = "Resources/ add.png"; sourceTree = ""; }; 14F0BC0C1288A67F00BA54F9 /* reply.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = " reply.png"; path = "Resources/ reply.png"; sourceTree = ""; }; 14F56F3812664D350045EC82 /* arrow-bottom.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = " arrow-bottom.png"; path = "Resources/ arrow-bottom.png"; sourceTree = ""; }; 14F56F3912664D350045EC82 /* arrow-left.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = " arrow-left.png"; path = "Resources/ arrow-left.png"; sourceTree = ""; }; 14F56F3A12664D350045EC82 /* arrow-right.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = " arrow-right.png"; path = "Resources/ arrow-right.png"; sourceTree = ""; }; 14F56F3B12664D350045EC82 /* arrow-top.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = " arrow-top.png"; path = "Resources/ arrow-top.png"; sourceTree = ""; }; 14F56F3C12664D350045EC82 /* background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = " background.png"; path = "Resources/ background.png"; sourceTree = ""; }; 14F56F4212664D430045EC82 /* UIPopoverView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIPopoverView.h; sourceTree = ""; }; 14F56F4312664D430045EC82 /* UIPopoverView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIPopoverView.m; sourceTree = ""; }; 14FA8C47121DA4A000C4264B /* UINinePartImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UINinePartImage.h; sourceTree = ""; }; 14FA8C48121DA4A000C4264B /* UINinePartImage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UINinePartImage.m; sourceTree = ""; }; 14FA8C4F121DA4A000C4264B /* UIScroller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIScroller.h; sourceTree = ""; }; 14FA8C50121DA4A000C4264B /* UIScroller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIScroller.m; sourceTree = ""; }; 14FA8C51121DA4A000C4264B /* UITableViewCellSeparator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UITableViewCellSeparator.h; sourceTree = ""; }; 14FA8C52121DA4A000C4264B /* UITableViewCellSeparator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UITableViewCellSeparator.m; sourceTree = ""; }; 14FA8C53121DA4A000C4264B /* UITableViewSection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UITableViewSection.h; sourceTree = ""; }; 14FA8C54121DA4A000C4264B /* UITableViewSection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UITableViewSection.m; sourceTree = ""; }; 14FA8C55121DA4A000C4264B /* UITableViewSectionLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UITableViewSectionLabel.h; sourceTree = ""; }; 14FA8C56121DA4A000C4264B /* UITableViewSectionLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UITableViewSectionLabel.m; sourceTree = ""; }; 14FA8C57121DA4A000C4264B /* UIThreePartImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIThreePartImage.h; sourceTree = ""; }; 14FA8C58121DA4A000C4264B /* UIThreePartImage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIThreePartImage.m; sourceTree = ""; }; 14FA8C59121DA4A000C4264B /* UIViewAnimationGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIViewAnimationGroup.h; sourceTree = ""; }; 14FA8C5A121DA4A000C4264B /* UIViewAnimationGroup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIViewAnimationGroup.m; sourceTree = ""; }; 14FA8C5B121DA4A000C4264B /* UIViewLayoutManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIViewLayoutManager.h; sourceTree = ""; }; 14FA8C5C121DA4A000C4264B /* UIViewLayoutManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIViewLayoutManager.m; sourceTree = ""; }; 14FDE99A153C9A1800A2D499 /* UIAppearance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIAppearance.h; sourceTree = ""; }; 14FDE9A3153CAECA00A2D499 /* UIAppearanceProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIAppearanceProxy.h; sourceTree = ""; }; 14FDE9A4153CAECA00A2D499 /* UIAppearanceProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIAppearanceProxy.m; sourceTree = ""; }; 32DBCF5E0370ADEE00C91783 /* UIKit_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIKit_Prefix.pch; sourceTree = ""; }; 38615C77133A81B900841EEA /* UIFont+UIPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIFont+UIPrivate.h"; sourceTree = ""; }; 38E523AF1339680400E041B3 /* UINavigationItem+UIPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UINavigationItem+UIPrivate.h"; sourceTree = ""; }; 38E523B413396B5B00E041B3 /* UINavigationBar+UIPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UINavigationBar+UIPrivate.h"; sourceTree = ""; }; 537472D3133ADD4B00EBD5EA /* UIInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIInterface.h; sourceTree = ""; }; 537472D4133ADD4B00EBD5EA /* UIInterface.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIInterface.m; sourceTree = ""; }; 7011107A133BE0F300C86512 /* UIDatePicker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIDatePicker.h; sourceTree = ""; }; 7011107B133BE0F300C86512 /* UIDatePicker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIDatePicker.m; sourceTree = ""; }; 7806ED28133A1D7500273BC6 /* UITabBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UITabBar.h; sourceTree = ""; }; 7806ED29133A1D7500273BC6 /* UITabBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UITabBar.m; sourceTree = ""; }; 789CF896133A3CD500250AB4 /* NSFetchedResultsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSFetchedResultsController.h; sourceTree = ""; }; 789CF897133A3CD500250AB4 /* NSFetchedResultsController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSFetchedResultsController.m; sourceTree = ""; }; 78CB48AA133A9C51008636DA /* UISearchBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UISearchBar.h; sourceTree = ""; }; 78CB48AB133A9C51008636DA /* UISearchBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UISearchBar.m; sourceTree = ""; }; 78CB48AE133AA535008636DA /* UITabBarItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UITabBarItem.h; sourceTree = ""; }; 78CB48AF133AA535008636DA /* UITabBarItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UITabBarItem.m; sourceTree = ""; }; 78CB48B2133AA8AF008636DA /* UISegmentedControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UISegmentedControl.h; sourceTree = ""; }; 78CB48B3133AA8AF008636DA /* UISegmentedControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UISegmentedControl.m; sourceTree = ""; }; 78CB48BA133AADCF008636DA /* UIPickerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIPickerView.h; sourceTree = ""; }; 78CB48BB133AADD0008636DA /* UIPickerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIPickerView.m; sourceTree = ""; }; 78CB48D7133AB91E008636DA /* UISlider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UISlider.h; sourceTree = ""; }; 78CB48D8133AB920008636DA /* UISlider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UISlider.m; sourceTree = ""; }; 78D533DB133A9434006F17CA /* UISearchDisplayController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UISearchDisplayController.h; sourceTree = ""; }; 78D533DC133A9434006F17CA /* UISearchDisplayController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UISearchDisplayController.m; sourceTree = ""; }; 8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 8DC2EF5B0486A6940098B216 /* UIKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = UIKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 8DC2EF560486A6940098B216 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 1444318E137D7FEE00B81304 /* IOKit.framework in Frameworks */, 8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */, 14CC844111EFA901005988CC /* QuartzCore.framework in Frameworks */, 14CC844511EFA91A005988CC /* SystemConfiguration.framework in Frameworks */, 1480633612A851230080C4BA /* QTKit.framework in Frameworks */, 1480633812A851230080C4BA /* WebKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 034768DFFF38A50411DB9C8B /* Products */ = { isa = PBXGroup; children = ( 8DC2EF5B0486A6940098B216 /* UIKit.framework */, ); name = Products; sourceTree = ""; }; 0867D691FE84028FC02AAC07 /* UIKit */ = { isa = PBXGroup; children = ( 1444318D137D7FEE00B81304 /* IOKit.framework */, 147A838C120C902C00422EDC /* Private Classes */, 14FA8C44121DA47500C4264B /* Private Categories */, 08FB77AEFE84172EC02AAC07 /* Classes */, 089C1665FE841158C02AAC07 /* Resources */, 32C88DFF0371C24200C91783 /* Other Sources */, 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */, 034768DFFF38A50411DB9C8B /* Products */, ); indentWidth = 4; name = UIKit; sourceTree = ""; tabWidth = 4; }; 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = { isa = PBXGroup; children = ( 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */, 14CC844011EFA901005988CC /* QuartzCore.framework */, 14CC844411EFA91A005988CC /* SystemConfiguration.framework */, 0867D6A5FE840307C02AAC07 /* AppKit.framework */, 0867D69BFE84028FC02AAC07 /* Foundation.framework */, 1480633512A851230080C4BA /* QTKit.framework */, 1480633712A851230080C4BA /* WebKit.framework */, ); name = "External Frameworks and Libraries"; sourceTree = ""; }; 089C1665FE841158C02AAC07 /* Resources */ = { isa = PBXGroup; children = ( 14F0BC0B1288A67F00BA54F9 /* add.png */, 148DEE88156E945800E7B8DE /* add@2x.png */, 14F0BC0C1288A67F00BA54F9 /* reply.png */, 1426A01E15701598004C2C9A /* reply@2x.png */, 1464960711FF7AE500ECEC7A /* back-highlighted.png */, 148DEE89156E945800E7B8DE /* back-highlighted@2x.png */, 1464960811FF7AE500ECEC7A /* back.png */, 148DEE8A156E945800E7B8DE /* back@2x.png */, 14F56F3812664D350045EC82 /* arrow-bottom.png */, 1426A01F15701598004C2C9A /* arrow-bottom@2x.png */, 14F56F3912664D350045EC82 /* arrow-left.png */, 1426A02015701598004C2C9A /* arrow-left@2x.png */, 14F56F3A12664D350045EC82 /* arrow-right.png */, 1426A02115701598004C2C9A /* arrow-right@2x.png */, 14F56F3B12664D350045EC82 /* arrow-top.png */, 1426A02215701598004C2C9A /* arrow-top@2x.png */, 14F56F3C12664D350045EC82 /* background.png */, 148DEE8B156E945800E7B8DE /* background@2x.png */, 14CC842D11EFA8BA005988CC /* highlighted.png */, 148DEE8C156E945800E7B8DE /* highlighted@2x.png */, 14CC842E11EFA8BA005988CC /* normal.png */, 148DEE8D156E945800E7B8DE /* normal@2x.png */, 14CC842F11EFA8BA005988CC /* grabber.png */, 148DEE8E156E945800E7B8DE /* grabber@2x.png */, 148DEE8F156E945800E7B8DE /* background.png */, 148DEE90156E945800E7B8DE /* background@2x.png */, 148DEE91156E945800E7B8DE /* item.png */, 148DEE92156E945800E7B8DE /* item@2x.png */, 14DD1C341289B4D500DCF231 /* button-highlighted.png */, 148DEE93156E945800E7B8DE /* button-highlighted@2x.png */, 14DD1C351289B4D500DCF231 /* button.png */, 148DEE94156E945800E7B8DE /* button@2x.png */, 8DC2EF5A0486A6940098B216 /* Info.plist */, ); name = Resources; sourceTree = ""; }; 08FB77AEFE84172EC02AAC07 /* Classes */ = { isa = PBXGroup; children = ( 148984E412EE2CFE003D4751 /* AppKitIntegration.h */, 789CF896133A3CD500250AB4 /* NSFetchedResultsController.h */, 789CF897133A3CD500250AB4 /* NSFetchedResultsController.m */, 148984E512EE2CFE003D4751 /* NSIndexPath+UITableView.h */, 148984E612EE2CFE003D4751 /* NSIndexPath+UITableView.m */, 148984E712EE2CFE003D4751 /* UIAcceleration.h */, 148984E812EE2CFE003D4751 /* UIAcceleration.m */, 148984E912EE2CFE003D4751 /* UIAccelerometer.h */, 148984EA12EE2CFE003D4751 /* UIAccelerometer.m */, 148984EB12EE2CFE003D4751 /* UIAccessibility.h */, 148984EC12EE2CFE003D4751 /* UIAccessibility.m */, 148984ED12EE2CFE003D4751 /* UIAccessibilityElement.h */, 148984EE12EE2CFE003D4751 /* UIAccessibilityElement.m */, 148984EF12EE2CFE003D4751 /* UIActionSheet.h */, 148984F012EE2CFE003D4751 /* UIActionSheet.m */, 148984F112EE2CFE003D4751 /* UIActionSheetAppKitIntegration.h */, 148984F212EE2CFE003D4751 /* UIActivityIndicatorView.h */, 148984F312EE2CFE003D4751 /* UIActivityIndicatorView.m */, 148984F412EE2CFE003D4751 /* UIAlertView.h */, 148984F512EE2CFE003D4751 /* UIAlertView.m */, 14FDE99A153C9A1800A2D499 /* UIAppearance.h */, 148984F612EE2CFE003D4751 /* UIApplication.h */, 148984F712EE2CFE003D4751 /* UIApplication.m */, 148984F812EE2CFE003D4751 /* UIApplicationAppKitIntegration.h */, 148984F912EE2CFE003D4751 /* UIApplicationDelegate.h */, 148984FA12EE2CFE003D4751 /* UIBarButtonItem.h */, 148984FB12EE2CFE003D4751 /* UIBarButtonItem.m */, 148984FC12EE2CFE003D4751 /* UIBarItem.h */, 148984FD12EE2CFE003D4751 /* UIBarItem.m */, 148984FE12EE2CFE003D4751 /* UIBezierPath.h */, 148984FF12EE2CFE003D4751 /* UIBezierPath.m */, 1489850012EE2CFE003D4751 /* UIButton.h */, 1489850112EE2CFE003D4751 /* UIButton.m */, 1489850212EE2CFE003D4751 /* UIColor.h */, 1489850312EE2CFE003D4751 /* UIColor.m */, 1489850412EE2CFE003D4751 /* UIColorAppKitIntegration.h */, 1489850512EE2CFE003D4751 /* UIControl.h */, 1489850612EE2CFE003D4751 /* UIControl.m */, 1489850712EE2CFE003D4751 /* UIDataDetectors.h */, 7011107A133BE0F300C86512 /* UIDatePicker.h */, 7011107B133BE0F300C86512 /* UIDatePicker.m */, 1489850812EE2CFE003D4751 /* UIDevice.h */, 1489850912EE2CFE003D4751 /* UIDevice.m */, 1489850A12EE2CFE003D4751 /* UIEvent.h */, 1489850B12EE2CFE003D4751 /* UIEvent.m */, 1489850C12EE2CFE003D4751 /* UIFont.h */, 1489850D12EE2CFE003D4751 /* UIFont.m */, 1489850E12EE2CFE003D4751 /* UIFontAppKitIntegration.h */, 1489850F12EE2CFE003D4751 /* UIGeometry.h */, 1489851012EE2CFE003D4751 /* UIGeometry.m */, 1489851112EE2CFE003D4751 /* UIGestureRecognizer.h */, 1489851212EE2CFE003D4751 /* UIGestureRecognizer.m */, 149148BA12EE45ED00F7C34E /* UIGestureRecognizerSubclass.h */, 1489851312EE2CFE003D4751 /* UIGraphics.h */, 1489851412EE2CFE003D4751 /* UIGraphics.m */, 1489851512EE2CFE003D4751 /* UIImage.h */, 1489851612EE2CFE003D4751 /* UIImage.m */, 1489851712EE2CFE003D4751 /* UIImageAppKitIntegration.h */, 14E20662156FE88D0040349D /* UIImageAppKitIntegration.m */, 1489851812EE2CFE003D4751 /* UIImagePickerController.h */, 1489851912EE2CFE003D4751 /* UIImagePickerController.m */, 1489851A12EE2CFE003D4751 /* UIImageView.h */, 1489851B12EE2CFE003D4751 /* UIImageView.m */, 537472D3133ADD4B00EBD5EA /* UIInterface.h */, 537472D4133ADD4B00EBD5EA /* UIInterface.m */, 1489851C12EE2CFE003D4751 /* UIKey.h */, 1489851D12EE2CFE003D4751 /* UIKey.m */, 1489851E12EE2CFE003D4751 /* UIKit.h */, 1489851F12EE2CFE003D4751 /* UIKitView.h */, 1489852012EE2CFE003D4751 /* UIKitView.m */, 1489852112EE2CFE003D4751 /* UILabel.h */, 1489852212EE2CFE003D4751 /* UILabel.m */, 1489852312EE2CFE003D4751 /* UILongPressGestureRecognizer.h */, 1489852412EE2CFE003D4751 /* UILongPressGestureRecognizer.m */, 1489852512EE2CFE003D4751 /* UIMenuController.h */, 1489852612EE2CFE003D4751 /* UIMenuController.m */, 1489852712EE2CFE003D4751 /* UIMenuItem.h */, 1489852812EE2CFE003D4751 /* UIMenuItem.m */, 1489852912EE2CFE003D4751 /* UINavigationBar.h */, 1489852A12EE2CFE003D4751 /* UINavigationBar.m */, 1489852B12EE2CFE003D4751 /* UINavigationController.h */, 1489852C12EE2CFE003D4751 /* UINavigationController.m */, 1489852D12EE2CFE003D4751 /* UINavigationItem.h */, 1489852E12EE2CFE003D4751 /* UINavigationItem.m */, 1489852F12EE2CFE003D4751 /* UINibLoading.h */, 1489853012EE2CFE003D4751 /* UINibLoading.m */, 1489853112EE2CFE003D4751 /* UIPageControl.h */, 1489853212EE2CFE003D4751 /* UIPageControl.m */, 1489860812EE2DDC003D4751 /* UIPanGestureRecognizer.h */, 1489860912EE2DDC003D4751 /* UIPanGestureRecognizer.m */, 1489853312EE2CFE003D4751 /* UIPasteboard.h */, 1489853412EE2CFE003D4751 /* UIPasteboard.m */, 78CB48BA133AADCF008636DA /* UIPickerView.h */, 78CB48BB133AADD0008636DA /* UIPickerView.m */, 1489853512EE2CFE003D4751 /* UIPinchGestureRecognizer.h */, 1489853612EE2CFE003D4751 /* UIPinchGestureRecognizer.m */, 1489853712EE2CFE003D4751 /* UIPopoverController.h */, 1489853812EE2CFE003D4751 /* UIPopoverController.m */, 1489853912EE2CFE003D4751 /* UIProgressView.h */, 1489853A12EE2CFE003D4751 /* UIProgressView.m */, 1489853B12EE2CFE003D4751 /* UIResponder.h */, 1489853C12EE2CFE003D4751 /* UIResponder.m */, 1489853D12EE2CFE003D4751 /* UIResponderAppKitIntegration.h */, 1489853E12EE2CFE003D4751 /* UIResponderAppKitIntegration.m */, 1489860012EE2D9F003D4751 /* UIRotationGestureRecognizer.h */, 1489860112EE2D9F003D4751 /* UIRotationGestureRecognizer.m */, 1489853F12EE2CFE003D4751 /* UIScreen.h */, 1489854012EE2CFE003D4751 /* UIScreen.m */, 1489854112EE2CFE003D4751 /* UIScreenAppKitIntegration.h */, 1489854212EE2CFE003D4751 /* UIScreenAppKitIntegration.m */, 1489854312EE2CFE003D4751 /* UIScreenMode.h */, 1489854412EE2CFE003D4751 /* UIScreenMode.m */, 1489854512EE2CFE003D4751 /* UIScrollView.h */, 1489854612EE2CFE003D4751 /* UIScrollView.m */, 14C0716013CF66B600B76E35 /* UIScrollWheelGestureRecognizer.h */, 14C0716113CF66B700B76E35 /* UIScrollWheelGestureRecognizer.m */, 78CB48AA133A9C51008636DA /* UISearchBar.h */, 78CB48AB133A9C51008636DA /* UISearchBar.m */, 78D533DB133A9434006F17CA /* UISearchDisplayController.h */, 78D533DC133A9434006F17CA /* UISearchDisplayController.m */, 78CB48B2133AA8AF008636DA /* UISegmentedControl.h */, 78CB48B3133AA8AF008636DA /* UISegmentedControl.m */, 78CB48D7133AB91E008636DA /* UISlider.h */, 78CB48D8133AB920008636DA /* UISlider.m */, 1489854712EE2CFE003D4751 /* UISplitViewController.h */, 1489854812EE2CFE003D4751 /* UISplitViewController.m */, 1489854912EE2CFE003D4751 /* UIStringDrawing.h */, 1489854A12EE2CFE003D4751 /* UIStringDrawing.m */, 1489860412EE2DBD003D4751 /* UISwipeGestureRecognizer.h */, 1489860512EE2DBD003D4751 /* UISwipeGestureRecognizer.m */, 1489854B12EE2CFE003D4751 /* UISwitch.h */, 1489854C12EE2CFE003D4751 /* UISwitch.m */, 7806ED28133A1D7500273BC6 /* UITabBar.h */, 7806ED29133A1D7500273BC6 /* UITabBar.m */, 1489854D12EE2CFE003D4751 /* UITabBarController.h */, 1489854E12EE2CFE003D4751 /* UITabBarController.m */, 78CB48AE133AA535008636DA /* UITabBarItem.h */, 78CB48AF133AA535008636DA /* UITabBarItem.m */, 1489854F12EE2CFE003D4751 /* UITableView.h */, 1489855012EE2CFE003D4751 /* UITableView.m */, 1489855112EE2CFE003D4751 /* UITableViewCell.h */, 1489855212EE2CFE003D4751 /* UITableViewCell.m */, 1489855312EE2CFE003D4751 /* UITableViewController.h */, 1489855412EE2CFE003D4751 /* UITableViewController.m */, 1489855512EE2CFE003D4751 /* UITapGestureRecognizer.h */, 1489855612EE2CFE003D4751 /* UITapGestureRecognizer.m */, 1489855712EE2CFE003D4751 /* UITextField.h */, 1489855812EE2CFE003D4751 /* UITextField.m */, 1489855912EE2CFE003D4751 /* UITextInputTraits.h */, 1489855A12EE2CFE003D4751 /* UITextView.h */, 1489855B12EE2CFE003D4751 /* UITextView.m */, 1489855C12EE2CFE003D4751 /* UIToolbar.h */, 1489855D12EE2CFE003D4751 /* UIToolbar.m */, 1489855E12EE2CFE003D4751 /* UITouch.h */, 1489855F12EE2CFE003D4751 /* UITouch.m */, 1489856012EE2CFE003D4751 /* UIView.h */, 1489856112EE2CFE003D4751 /* UIView.m */, 1489856212EE2CFE003D4751 /* UIViewAdapter.h */, 1489856312EE2CFE003D4751 /* UIViewAdapter.m */, 1489856412EE2CFE003D4751 /* UIViewController.h */, 1489856512EE2CFE003D4751 /* UIViewController.m */, 1489856612EE2CFE003D4751 /* UIWebView.h */, 1489856712EE2CFE003D4751 /* UIWebView.m */, 1489856812EE2CFE003D4751 /* UIWindow.h */, 1489856912EE2CFE003D4751 /* UIWindow.m */, ); path = Classes; sourceTree = ""; }; 147A838C120C902C00422EDC /* Private Classes */ = { isa = PBXGroup; children = ( 14C0715C13CF5A2300B76E35 /* UIAction.h */, 14C0715D13CF5A2300B76E35 /* UIAction.m */, 145576221541DC560029EF4D /* UIAppearanceInstance.h */, 145576251541DC830029EF4D /* UIAppearanceInstance.m */, 14D796361540A5DA00C02139 /* UIAppearanceProperty.h */, 14D796371540A5DA00C02139 /* UIAppearanceProperty.m */, 14FDE9A3153CAECA00A2D499 /* UIAppearanceProxy.h */, 14FDE9A4153CAECA00A2D499 /* UIAppearanceProxy.m */, 1443B06A13E06081001D7EC1 /* UIBackgroundTask.h */, 1443B06B13E06081001D7EC1 /* UIBackgroundTask.m */, 145335671226F1F90005644F /* UIBulletGlyphGenerator.h */, 145335681226F1F90005644F /* UIBulletGlyphGenerator.m */, 145BE31B15754F2400C41D70 /* UIColorRep.h */, 145BE31C15754F2400C41D70 /* UIColorRep.m */, 1426FFDB129ADEA300BD31E5 /* UIControlAction.h */, 1426FFDC129ADEA300BD31E5 /* UIControlAction.m */, 145335831226F3490005644F /* UICustomNSClipView.h */, 145335841226F3490005644F /* UICustomNSClipView.m */, 1453356F1226F2720005644F /* UICustomNSTextView.h */, 145335701226F2720005644F /* UICustomNSTextView.m */, 14711392156FC83F00251B2E /* UIImageRep.h */, 14711393156FC83F00251B2E /* UIImageRep.m */, 14D8D93F135DE90A00FE639A /* UIInputController.h */, 14D8D940135DE90A00FE639A /* UIInputController.m */, 14FA8C47121DA4A000C4264B /* UINinePartImage.h */, 14FA8C48121DA4A000C4264B /* UINinePartImage.m */, 14805D3F12A6B0E80080C4BA /* UINSClipView.h */, 14805D4012A6B0E80080C4BA /* UINSClipView.m */, 14541DB01360D6F300C1006D /* UIPhotosAlbum.h */, 14541DB11360D6F300C1006D /* UIPhotosAlbum.m */, 14CB384312689907003334AD /* UIPopoverNSWindow.h */, 14CB384412689907003334AD /* UIPopoverNSWindow.m */, 14CB384712689949003334AD /* UIPopoverOverlayNSView.h */, 14CB384812689949003334AD /* UIPopoverOverlayNSView.m */, 14F56F4212664D430045EC82 /* UIPopoverView.h */, 14F56F4312664D430045EC82 /* UIPopoverView.m */, 14CC839011EFA8AF005988CC /* UIRoundedRectButton.h */, 14CC839111EFA8AF005988CC /* UIRoundedRectButton.m */, 14FA8C4F121DA4A000C4264B /* UIScroller.h */, 14FA8C50121DA4A000C4264B /* UIScroller.m */, 1413D20C13D72A06004D77E9 /* UIScrollViewAnimation.h */, 1413D20D13D72A06004D77E9 /* UIScrollViewAnimation.m */, 1413D20E13D72A06004D77E9 /* UIScrollViewAnimationDeceleration.h */, 1413D20F13D72A06004D77E9 /* UIScrollViewAnimationDeceleration.m */, 1413D21013D72A06004D77E9 /* UIScrollViewAnimationScroll.h */, 1413D21113D72A06004D77E9 /* UIScrollViewAnimationScroll.m */, 14FA8C51121DA4A000C4264B /* UITableViewCellSeparator.h */, 14FA8C52121DA4A000C4264B /* UITableViewCellSeparator.m */, 14FA8C53121DA4A000C4264B /* UITableViewSection.h */, 14FA8C54121DA4A000C4264B /* UITableViewSection.m */, 14FA8C55121DA4A000C4264B /* UITableViewSectionLabel.h */, 14FA8C56121DA4A000C4264B /* UITableViewSectionLabel.m */, 145335631226F03E0005644F /* UITextLayer.h */, 145335641226F03E0005644F /* UITextLayer.m */, 14FA8C57121DA4A000C4264B /* UIThreePartImage.h */, 14FA8C58121DA4A000C4264B /* UIThreePartImage.m */, 144156D91284A22200532FE2 /* UIToolbarButton.h */, 144156DA1284A22200532FE2 /* UIToolbarButton.m */, 1457DD3D128DDE610057A7F9 /* UITransitionView.h */, 1457DD3E128DDE610057A7F9 /* UITransitionView.m */, 14FA8C59121DA4A000C4264B /* UIViewAnimationGroup.h */, 14FA8C5A121DA4A000C4264B /* UIViewAnimationGroup.m */, 14BF16D912E621EB007DAA01 /* UIViewBlockAnimationDelegate.h */, 14BF16DA12E621EB007DAA01 /* UIViewBlockAnimationDelegate.m */, 14FA8C5B121DA4A000C4264B /* UIViewLayoutManager.h */, 14FA8C5C121DA4A000C4264B /* UIViewLayoutManager.m */, ); name = "Private Classes"; path = Classes; sourceTree = ""; }; 14FA8C44121DA47500C4264B /* Private Categories */ = { isa = PBXGroup; children = ( 14A726AF1213303400648C9B /* UIApplication+UIPrivate.h */, 145BE3201575523000C41D70 /* UIColor+UIPrivate.h */, 14A726B11213303400648C9B /* UIControl+UIPrivate.h */, 14EEF76512DF67CF00EB7D95 /* UIEvent+UIPrivate.h */, 38615C77133A81B900841EEA /* UIFont+UIPrivate.h */, 148984A312EE278D003D4751 /* UIGestureRecognizer+UIPrivate.h */, 14A726B41213303400648C9B /* UIImage+UIPrivate.h */, 14DD1C271289B3C900DCF231 /* UIImage+UIPrivate.m */, 14A726B51213303400648C9B /* UIImageView+UIPrivate.h */, 14EEF7A812DF6D9C00EB7D95 /* UIKey+UIPrivate.h */, 38E523B413396B5B00E041B3 /* UINavigationBar+UIPrivate.h */, 38E523AF1339680400E041B3 /* UINavigationItem+UIPrivate.h */, 1490AFDE1219C31C00774286 /* UIPopoverController+UIPrivate.h */, 14A726B71213303400648C9B /* UIScreen+UIPrivate.h */, 1443DF23121F0D5A00E07C4A /* UIScreenMode+UIPrivate.h */, 14805F5812A6E2AE0080C4BA /* UIScrollView+UIPrivate.h */, 14A726B91213303400648C9B /* UITableViewCell+UIPrivate.h */, 14A726BA1213303400648C9B /* UITouch+UIPrivate.h */, 14A726BB1213303400648C9B /* UIView+UIPrivate.h */, 14A726BC1213303400648C9B /* UIViewController+UIPrivate.h */, 14A726BD1213303400648C9B /* UIWindow+UIPrivate.h */, ); name = "Private Categories"; path = Classes; sourceTree = ""; }; 32C88DFF0371C24200C91783 /* Other Sources */ = { isa = PBXGroup; children = ( 32DBCF5E0370ADEE00C91783 /* UIKit_Prefix.pch */, ); name = "Other Sources"; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ 8DC2EF500486A6940098B216 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( 78CB48D9133AB922008636DA /* UISlider.h in Headers */, 78CB48B4133AA8AF008636DA /* UISegmentedControl.h in Headers */, 14CC840611EFA8AF005988CC /* UIRoundedRectButton.h in Headers */, 78CB48BC133AADD0008636DA /* UIPickerView.h in Headers */, 14A726D21213303400648C9B /* UIApplication+UIPrivate.h in Headers */, 14A726D41213303400648C9B /* UIControl+UIPrivate.h in Headers */, 14A726D71213303400648C9B /* UIImage+UIPrivate.h in Headers */, 14A726D81213303400648C9B /* UIImageView+UIPrivate.h in Headers */, 14A726DA1213303400648C9B /* UIScreen+UIPrivate.h in Headers */, 14A726DC1213303400648C9B /* UITableViewCell+UIPrivate.h in Headers */, 14A726DD1213303400648C9B /* UITouch+UIPrivate.h in Headers */, 14A726DE1213303400648C9B /* UIView+UIPrivate.h in Headers */, 14A726DF1213303400648C9B /* UIViewController+UIPrivate.h in Headers */, 78CB48B0133AA536008636DA /* UITabBarItem.h in Headers */, 14A726E01213303400648C9B /* UIWindow+UIPrivate.h in Headers */, 78D533DD133A9434006F17CA /* UISearchDisplayController.h in Headers */, 78CB48AC133A9C51008636DA /* UISearchBar.h in Headers */, 1489856A12EE2CFF003D4751 /* AppKitIntegration.h in Headers */, 1489856B12EE2CFF003D4751 /* NSIndexPath+UITableView.h in Headers */, 1489856D12EE2CFF003D4751 /* UIAcceleration.h in Headers */, 1489856F12EE2CFF003D4751 /* UIAccelerometer.h in Headers */, 1489857112EE2CFF003D4751 /* UIAccessibility.h in Headers */, 1489857312EE2CFF003D4751 /* UIAccessibilityElement.h in Headers */, 1489857512EE2CFF003D4751 /* UIActionSheet.h in Headers */, 1489857712EE2CFF003D4751 /* UIActionSheetAppKitIntegration.h in Headers */, 1489857812EE2CFF003D4751 /* UIActivityIndicatorView.h in Headers */, 1489857A12EE2CFF003D4751 /* UIAlertView.h in Headers */, 1489857C12EE2CFF003D4751 /* UIApplication.h in Headers */, 1489857E12EE2CFF003D4751 /* UIApplicationAppKitIntegration.h in Headers */, 1489857F12EE2CFF003D4751 /* UIApplicationDelegate.h in Headers */, 1489858012EE2CFF003D4751 /* UIBarButtonItem.h in Headers */, 1489858212EE2CFF003D4751 /* UIBarItem.h in Headers */, 1489858412EE2CFF003D4751 /* UIBezierPath.h in Headers */, 1489858612EE2CFF003D4751 /* UIButton.h in Headers */, 1489858812EE2CFF003D4751 /* UIColor.h in Headers */, 1489858A12EE2CFF003D4751 /* UIColorAppKitIntegration.h in Headers */, 1489858B12EE2CFF003D4751 /* UIControl.h in Headers */, 1489858D12EE2CFF003D4751 /* UIDataDetectors.h in Headers */, 1489858E12EE2CFF003D4751 /* UIDevice.h in Headers */, 1489859012EE2CFF003D4751 /* UIEvent.h in Headers */, 1489859212EE2CFF003D4751 /* UIFont.h in Headers */, 1489859412EE2CFF003D4751 /* UIFontAppKitIntegration.h in Headers */, 1489859512EE2CFF003D4751 /* UIGeometry.h in Headers */, 1489859712EE2CFF003D4751 /* UIGestureRecognizer.h in Headers */, 1489859912EE2CFF003D4751 /* UIGraphics.h in Headers */, 7806ED2A133A1D7500273BC6 /* UITabBar.h in Headers */, 1489859B12EE2CFF003D4751 /* UIImage.h in Headers */, 1489859D12EE2CFF003D4751 /* UIImageAppKitIntegration.h in Headers */, 1489859E12EE2CFF003D4751 /* UIImagePickerController.h in Headers */, 148985A012EE2CFF003D4751 /* UIImageView.h in Headers */, 148985A212EE2CFF003D4751 /* UIKey.h in Headers */, 148985A412EE2CFF003D4751 /* UIKit.h in Headers */, 148985A512EE2CFF003D4751 /* UIKitView.h in Headers */, 148985A712EE2CFF003D4751 /* UILabel.h in Headers */, 148985A912EE2CFF003D4751 /* UILongPressGestureRecognizer.h in Headers */, 148985AB12EE2CFF003D4751 /* UIMenuController.h in Headers */, 148985AD12EE2CFF003D4751 /* UIMenuItem.h in Headers */, 148985AF12EE2CFF003D4751 /* UINavigationBar.h in Headers */, 148985B112EE2CFF003D4751 /* UINavigationController.h in Headers */, 1490AFE01219C31C00774286 /* UIPopoverController+UIPrivate.h in Headers */, 14FA8C5F121DA4A000C4264B /* UINinePartImage.h in Headers */, 14FA8C67121DA4A000C4264B /* UIScroller.h in Headers */, 14FA8C69121DA4A000C4264B /* UITableViewCellSeparator.h in Headers */, 14FA8C6B121DA4A000C4264B /* UITableViewSection.h in Headers */, 14FA8C6D121DA4A000C4264B /* UITableViewSectionLabel.h in Headers */, 14FA8C6F121DA4A000C4264B /* UIThreePartImage.h in Headers */, 14FA8C71121DA4A000C4264B /* UIViewAnimationGroup.h in Headers */, 14FA8C73121DA4A000C4264B /* UIViewLayoutManager.h in Headers */, 1443DF24121F0D5A00E07C4A /* UIScreenMode+UIPrivate.h in Headers */, 145335651226F03E0005644F /* UITextLayer.h in Headers */, 145335691226F1F90005644F /* UIBulletGlyphGenerator.h in Headers */, 145335711226F2720005644F /* UICustomNSTextView.h in Headers */, 145335851226F3490005644F /* UICustomNSClipView.h in Headers */, 14F56F4412664D430045EC82 /* UIPopoverView.h in Headers */, 14CB384512689907003334AD /* UIPopoverNSWindow.h in Headers */, 14CB384912689949003334AD /* UIPopoverOverlayNSView.h in Headers */, 1457DD3F128DDE610057A7F9 /* UITransitionView.h in Headers */, 14805F5A12A6E2AE0080C4BA /* UIScrollView+UIPrivate.h in Headers */, 14EEF76712DF67CF00EB7D95 /* UIEvent+UIPrivate.h in Headers */, 14EEF7A912DF6D9C00EB7D95 /* UIKey+UIPrivate.h in Headers */, 14BF16DB12E621EB007DAA01 /* UIViewBlockAnimationDelegate.h in Headers */, 148984A512EE278D003D4751 /* UIGestureRecognizer+UIPrivate.h in Headers */, 38E523B11339680400E041B3 /* UINavigationItem+UIPrivate.h in Headers */, 14805D4112A6B0E80080C4BA /* UINSClipView.h in Headers */, 144156DB1284A22200532FE2 /* UIToolbarButton.h in Headers */, 1426FFDD129ADEA300BD31E5 /* UIControlAction.h in Headers */, 14C0716213CF66B800B76E35 /* UIScrollWheelGestureRecognizer.h in Headers */, 38E523B513396B5B00E041B3 /* UINavigationBar+UIPrivate.h in Headers */, 14FDE99C153C9A1800A2D499 /* UIAppearance.h in Headers */, 38615C78133A81B900841EEA /* UIFont+UIPrivate.h in Headers */, 148985B312EE2CFF003D4751 /* UINavigationItem.h in Headers */, 148985B512EE2CFF003D4751 /* UINibLoading.h in Headers */, 148985B712EE2CFF003D4751 /* UIPageControl.h in Headers */, 148985B912EE2CFF003D4751 /* UIPasteboard.h in Headers */, 148985BB12EE2CFF003D4751 /* UIPinchGestureRecognizer.h in Headers */, 148985BD12EE2CFF003D4751 /* UIPopoverController.h in Headers */, 148985BF12EE2CFF003D4751 /* UIProgressView.h in Headers */, 148985C112EE2CFF003D4751 /* UIResponder.h in Headers */, 148985C312EE2CFF003D4751 /* UIResponderAppKitIntegration.h in Headers */, 148985C512EE2CFF003D4751 /* UIScreen.h in Headers */, 148985C712EE2CFF003D4751 /* UIScreenAppKitIntegration.h in Headers */, 148985C912EE2CFF003D4751 /* UIScreenMode.h in Headers */, 148985CB12EE2CFF003D4751 /* UIScrollView.h in Headers */, 148985CD12EE2CFF003D4751 /* UISplitViewController.h in Headers */, 148985CF12EE2CFF003D4751 /* UIStringDrawing.h in Headers */, 148985D112EE2CFF003D4751 /* UISwitch.h in Headers */, 148985D312EE2CFF003D4751 /* UITabBarController.h in Headers */, 148985D512EE2CFF003D4751 /* UITableView.h in Headers */, 148985D712EE2CFF003D4751 /* UITableViewCell.h in Headers */, 148985D912EE2CFF003D4751 /* UITableViewController.h in Headers */, 148985DB12EE2CFF003D4751 /* UITapGestureRecognizer.h in Headers */, 148985DD12EE2CFF003D4751 /* UITextField.h in Headers */, 148985DF12EE2CFF003D4751 /* UITextInputTraits.h in Headers */, 148985E012EE2CFF003D4751 /* UITextView.h in Headers */, 148985E212EE2CFF003D4751 /* UIToolbar.h in Headers */, 148985E412EE2CFF003D4751 /* UITouch.h in Headers */, 148985E612EE2CFF003D4751 /* UIView.h in Headers */, 148985E812EE2CFF003D4751 /* UIViewAdapter.h in Headers */, 148985EA12EE2CFF003D4751 /* UIViewController.h in Headers */, 148985EC12EE2CFF003D4751 /* UIWebView.h in Headers */, 148985EE12EE2CFF003D4751 /* UIWindow.h in Headers */, 1489860212EE2D9F003D4751 /* UIRotationGestureRecognizer.h in Headers */, 1489860612EE2DBD003D4751 /* UISwipeGestureRecognizer.h in Headers */, 1489860A12EE2DDC003D4751 /* UIPanGestureRecognizer.h in Headers */, 149148BC12EE45ED00F7C34E /* UIGestureRecognizerSubclass.h in Headers */, 7011107C133BE0F400C86512 /* UIDatePicker.h in Headers */, 1413D21213D72A06004D77E9 /* UIScrollViewAnimation.h in Headers */, 1413D21413D72A06004D77E9 /* UIScrollViewAnimationDeceleration.h in Headers */, 1413D21613D72A06004D77E9 /* UIScrollViewAnimationScroll.h in Headers */, 1443B06C13E06081001D7EC1 /* UIBackgroundTask.h in Headers */, 537472D5133ADD4B00EBD5EA /* UIInterface.h in Headers */, 14D8D941135DE90A00FE639A /* UIInputController.h in Headers */, 14541DB21360D6F300C1006D /* UIPhotosAlbum.h in Headers */, 14C0715E13CF5A2400B76E35 /* UIAction.h in Headers */, 14FDE9A5153CAECA00A2D499 /* UIAppearanceProxy.h in Headers */, 14D796381540A5DA00C02139 /* UIAppearanceProperty.h in Headers */, 145576231541DC560029EF4D /* UIAppearanceInstance.h in Headers */, 14711394156FC83F00251B2E /* UIImageRep.h in Headers */, 145BE31D15754F2400C41D70 /* UIColorRep.h in Headers */, 145BE3211575523000C41D70 /* UIColor+UIPrivate.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ 8DC2EF4F0486A6940098B216 /* UIKit */ = { isa = PBXNativeTarget; buildConfigurationList = 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "UIKit" */; buildPhases = ( 8DC2EF500486A6940098B216 /* Headers */, 8DC2EF520486A6940098B216 /* Resources */, 8DC2EF540486A6940098B216 /* Sources */, 8DC2EF560486A6940098B216 /* Frameworks */, ); buildRules = ( ); dependencies = ( ); name = UIKit; productInstallPath = "$(HOME)/Library/Frameworks"; productName = UIKit; productReference = 8DC2EF5B0486A6940098B216 /* UIKit.framework */; productType = "com.apple.product-type.framework"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 0867D690FE84028FC02AAC07 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0800; }; buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "UIKit" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( English, Japanese, French, German, ); mainGroup = 0867D691FE84028FC02AAC07 /* UIKit */; productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 8DC2EF4F0486A6940098B216 /* UIKit */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 8DC2EF520486A6940098B216 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 14CC843511EFA8BA005988CC /* highlighted.png in Resources */, 14CC843611EFA8BA005988CC /* normal.png in Resources */, 14CC843711EFA8BA005988CC /* grabber.png in Resources */, 1464960B11FF7AE500ECEC7A /* back-highlighted.png in Resources */, 1464960C11FF7AE500ECEC7A /* back.png in Resources */, 14F56F3D12664D350045EC82 /* arrow-bottom.png in Resources */, 14F56F3E12664D350045EC82 /* arrow-left.png in Resources */, 14F56F3F12664D350045EC82 /* arrow-right.png in Resources */, 14F56F4012664D350045EC82 /* arrow-top.png in Resources */, 14F56F4112664D350045EC82 /* background.png in Resources */, 14F0BC0D1288A67F00BA54F9 /* add.png in Resources */, 14F0BC0E1288A67F00BA54F9 /* reply.png in Resources */, 14DD1C361289B4D500DCF231 /* button-highlighted.png in Resources */, 14DD1C371289B4D500DCF231 /* button.png in Resources */, 148DEE95156E945800E7B8DE /* add@2x.png in Resources */, 148DEE96156E945800E7B8DE /* back-highlighted@2x.png in Resources */, 148DEE97156E945800E7B8DE /* back@2x.png in Resources */, 148DEE98156E945800E7B8DE /* background@2x.png in Resources */, 148DEE99156E945800E7B8DE /* highlighted@2x.png in Resources */, 148DEE9A156E945800E7B8DE /* normal@2x.png in Resources */, 148DEE9B156E945800E7B8DE /* grabber@2x.png in Resources */, 148DEE9C156E945800E7B8DE /* background.png in Resources */, 148DEE9D156E945800E7B8DE /* background@2x.png in Resources */, 148DEE9E156E945800E7B8DE /* item.png in Resources */, 148DEE9F156E945800E7B8DE /* item@2x.png in Resources */, 148DEEA0156E945800E7B8DE /* button-highlighted@2x.png in Resources */, 148DEEA1156E945800E7B8DE /* button@2x.png in Resources */, 1426A02315701598004C2C9A /* reply@2x.png in Resources */, 1426A02415701598004C2C9A /* arrow-bottom@2x.png in Resources */, 1426A02515701598004C2C9A /* arrow-left@2x.png in Resources */, 1426A02615701598004C2C9A /* arrow-right@2x.png in Resources */, 1426A02715701598004C2C9A /* arrow-top@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 8DC2EF540486A6940098B216 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 78CB48B1133AA536008636DA /* UITabBarItem.m in Sources */, 78CB48AD133A9C51008636DA /* UISearchBar.m in Sources */, 14CC840711EFA8AF005988CC /* UIRoundedRectButton.m in Sources */, 14FA8C60121DA4A000C4264B /* UINinePartImage.m in Sources */, 14FA8C68121DA4A000C4264B /* UIScroller.m in Sources */, 14FA8C6A121DA4A000C4264B /* UITableViewCellSeparator.m in Sources */, 14FA8C6C121DA4A000C4264B /* UITableViewSection.m in Sources */, 14FA8C6E121DA4A000C4264B /* UITableViewSectionLabel.m in Sources */, 14FA8C70121DA4A000C4264B /* UIThreePartImage.m in Sources */, 14FA8C72121DA4A000C4264B /* UIViewAnimationGroup.m in Sources */, 14FA8C74121DA4A000C4264B /* UIViewLayoutManager.m in Sources */, 145335661226F03E0005644F /* UITextLayer.m in Sources */, 1453356A1226F1F90005644F /* UIBulletGlyphGenerator.m in Sources */, 145335721226F2720005644F /* UICustomNSTextView.m in Sources */, 145335861226F3490005644F /* UICustomNSClipView.m in Sources */, 14F56F4512664D430045EC82 /* UIPopoverView.m in Sources */, 14CB384612689907003334AD /* UIPopoverNSWindow.m in Sources */, 14CB384A12689949003334AD /* UIPopoverOverlayNSView.m in Sources */, 144156DC1284A22200532FE2 /* UIToolbarButton.m in Sources */, 14DD1C281289B3C900DCF231 /* UIImage+UIPrivate.m in Sources */, 1457DD40128DDE610057A7F9 /* UITransitionView.m in Sources */, 1426FFDE129ADEA300BD31E5 /* UIControlAction.m in Sources */, 14805D4212A6B0E80080C4BA /* UINSClipView.m in Sources */, 14BF16DC12E621EB007DAA01 /* UIViewBlockAnimationDelegate.m in Sources */, 1489856C12EE2CFF003D4751 /* NSIndexPath+UITableView.m in Sources */, 1489856E12EE2CFF003D4751 /* UIAcceleration.m in Sources */, 1489857012EE2CFF003D4751 /* UIAccelerometer.m in Sources */, 1489857212EE2CFF003D4751 /* UIAccessibility.m in Sources */, 1489857412EE2CFF003D4751 /* UIAccessibilityElement.m in Sources */, 1489857612EE2CFF003D4751 /* UIActionSheet.m in Sources */, 1489857912EE2CFF003D4751 /* UIActivityIndicatorView.m in Sources */, 1489857B12EE2CFF003D4751 /* UIAlertView.m in Sources */, 1489857D12EE2CFF003D4751 /* UIApplication.m in Sources */, 1489858112EE2CFF003D4751 /* UIBarButtonItem.m in Sources */, 1489858312EE2CFF003D4751 /* UIBarItem.m in Sources */, 1489858512EE2CFF003D4751 /* UIBezierPath.m in Sources */, 1489858712EE2CFF003D4751 /* UIButton.m in Sources */, 1489858912EE2CFF003D4751 /* UIColor.m in Sources */, 1489858C12EE2CFF003D4751 /* UIControl.m in Sources */, 1489858F12EE2CFF003D4751 /* UIDevice.m in Sources */, 1489859112EE2CFF003D4751 /* UIEvent.m in Sources */, 1489859312EE2CFF003D4751 /* UIFont.m in Sources */, 1489859612EE2CFF003D4751 /* UIGeometry.m in Sources */, 1489859812EE2CFF003D4751 /* UIGestureRecognizer.m in Sources */, 1489859A12EE2CFF003D4751 /* UIGraphics.m in Sources */, 1489859C12EE2CFF003D4751 /* UIImage.m in Sources */, 1489859F12EE2CFF003D4751 /* UIImagePickerController.m in Sources */, 148985A112EE2CFF003D4751 /* UIImageView.m in Sources */, 148985A312EE2CFF003D4751 /* UIKey.m in Sources */, 148985A612EE2CFF003D4751 /* UIKitView.m in Sources */, 148985A812EE2CFF003D4751 /* UILabel.m in Sources */, 148985AA12EE2CFF003D4751 /* UILongPressGestureRecognizer.m in Sources */, 148985AC12EE2CFF003D4751 /* UIMenuController.m in Sources */, 148985AE12EE2CFF003D4751 /* UIMenuItem.m in Sources */, 148985B012EE2CFF003D4751 /* UINavigationBar.m in Sources */, 148985B212EE2CFF003D4751 /* UINavigationController.m in Sources */, 148985B412EE2CFF003D4751 /* UINavigationItem.m in Sources */, 148985B612EE2CFF003D4751 /* UINibLoading.m in Sources */, 148985B812EE2CFF003D4751 /* UIPageControl.m in Sources */, 148985BA12EE2CFF003D4751 /* UIPasteboard.m in Sources */, 148985BC12EE2CFF003D4751 /* UIPinchGestureRecognizer.m in Sources */, 148985BE12EE2CFF003D4751 /* UIPopoverController.m in Sources */, 148985C012EE2CFF003D4751 /* UIProgressView.m in Sources */, 148985C212EE2CFF003D4751 /* UIResponder.m in Sources */, 148985C412EE2CFF003D4751 /* UIResponderAppKitIntegration.m in Sources */, 148985C612EE2CFF003D4751 /* UIScreen.m in Sources */, 148985C812EE2CFF003D4751 /* UIScreenAppKitIntegration.m in Sources */, 148985CA12EE2CFF003D4751 /* UIScreenMode.m in Sources */, 148985CC12EE2CFF003D4751 /* UIScrollView.m in Sources */, 148985CE12EE2CFF003D4751 /* UISplitViewController.m in Sources */, 148985D012EE2CFF003D4751 /* UIStringDrawing.m in Sources */, 148985D212EE2CFF003D4751 /* UISwitch.m in Sources */, 148985D412EE2CFF003D4751 /* UITabBarController.m in Sources */, 148985D612EE2CFF003D4751 /* UITableView.m in Sources */, 148985D812EE2CFF003D4751 /* UITableViewCell.m in Sources */, 148985DA12EE2CFF003D4751 /* UITableViewController.m in Sources */, 78D533DE133A9434006F17CA /* UISearchDisplayController.m in Sources */, 148985DC12EE2CFF003D4751 /* UITapGestureRecognizer.m in Sources */, 148985DE12EE2CFF003D4751 /* UITextField.m in Sources */, 148985E112EE2CFF003D4751 /* UITextView.m in Sources */, 148985E312EE2CFF003D4751 /* UIToolbar.m in Sources */, 148985E512EE2CFF003D4751 /* UITouch.m in Sources */, 148985E712EE2CFF003D4751 /* UIView.m in Sources */, 148985E912EE2CFF003D4751 /* UIViewAdapter.m in Sources */, 148985EB12EE2CFF003D4751 /* UIViewController.m in Sources */, 148985ED12EE2CFF003D4751 /* UIWebView.m in Sources */, 148985EF12EE2CFF003D4751 /* UIWindow.m in Sources */, 1489860312EE2D9F003D4751 /* UIRotationGestureRecognizer.m in Sources */, 1489860712EE2DBD003D4751 /* UISwipeGestureRecognizer.m in Sources */, 1489860B12EE2DDC003D4751 /* UIPanGestureRecognizer.m in Sources */, 7806ED2B133A1D7500273BC6 /* UITabBar.m in Sources */, 78CB48B5133AA8AF008636DA /* UISegmentedControl.m in Sources */, 78CB48BD133AADD0008636DA /* UIPickerView.m in Sources */, 78CB48DA133AB922008636DA /* UISlider.m in Sources */, 7011107D133BE0F400C86512 /* UIDatePicker.m in Sources */, 537472D6133ADD4B00EBD5EA /* UIInterface.m in Sources */, 14D8D942135DE90A00FE639A /* UIInputController.m in Sources */, 14541DB31360D6F300C1006D /* UIPhotosAlbum.m in Sources */, 14C0715F13CF5A2400B76E35 /* UIAction.m in Sources */, 14C0716313CF66B800B76E35 /* UIScrollWheelGestureRecognizer.m in Sources */, 1413D21313D72A06004D77E9 /* UIScrollViewAnimation.m in Sources */, 1413D21513D72A06004D77E9 /* UIScrollViewAnimationDeceleration.m in Sources */, 1413D21713D72A06004D77E9 /* UIScrollViewAnimationScroll.m in Sources */, 1443B06D13E06081001D7EC1 /* UIBackgroundTask.m in Sources */, 14FDE9A6153CAECA00A2D499 /* UIAppearanceProxy.m in Sources */, 14D796391540A5DA00C02139 /* UIAppearanceProperty.m in Sources */, 145576261541DC830029EF4D /* UIAppearanceInstance.m in Sources */, 14711395156FC83F00251B2E /* UIImageRep.m in Sources */, 14E20663156FE88D0040349D /* UIImageAppKitIntegration.m in Sources */, 145BE31E15754F2400C41D70 /* UIColorRep.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin XCBuildConfiguration section */ 1DEB91AE08733DA50010E9CD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = UIKit_Prefix.pch; GCC_VERSION = ""; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = org.chameleonproject.UIKit; PRODUCT_NAME = UIKit; SYMROOT = ../build; VALID_ARCHS = "i386 x86_64"; WRAPPER_EXTENSION = framework; }; name = Debug; }; 1DEB91AF08733DA50010E9CD /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CODE_SIGN_IDENTITY = ""; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = UIKit_Prefix.pch; GCC_VERSION = ""; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = org.chameleonproject.UIKit; PRODUCT_NAME = UIKit; SYMROOT = ../build; VALID_ARCHS = "i386 x86_64"; WRAPPER_EXTENSION = framework; }; name = Release; }; 1DEB91B208733DA50010E9CD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.6; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; }; name = Debug; }; 1DEB91B308733DA50010E9CD /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = "3rd Party Mac Developer Application"; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.6; PROVISIONING_PROFILE = ""; SDKROOT = macosx; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "UIKit" */ = { isa = XCConfigurationList; buildConfigurations = ( 1DEB91AE08733DA50010E9CD /* Debug */, 1DEB91AF08733DA50010E9CD /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "UIKit" */ = { isa = XCConfigurationList; buildConfigurations = ( 1DEB91B208733DA50010E9CD /* Debug */, 1DEB91B308733DA50010E9CD /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 0867D690FE84028FC02AAC07 /* Project object */; } ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/UIKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: Examples/Chameleon Demo/Chameleon/UIKit/UIKit_Prefix.pch ================================================ /* * Copyright (c) 2011, The Iconfactory. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of The Iconfactory nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE ICONFACTORY BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifdef __OBJC__ #import #endif ================================================ FILE: Examples/Chameleon Demo/iCarouselChameleonDemo/MacAppDelegate.h ================================================ // // AppDelegate.h // iCarouselChameleonDemo // // Created by Nick Lockwood on 25/12/2011. // Copyright (c) 2011 __MyCompanyName__. All rights reserved. // #import #import @interface MacAppDelegate : NSObject @property (nonatomic, unsafe_unretained) IBOutlet NSWindow *window; @property (nonatomic, unsafe_unretained) IBOutlet UIKitView *chameleonNSView; @end ================================================ FILE: Examples/Chameleon Demo/iCarouselChameleonDemo/MacAppDelegate.m ================================================ // // AppDelegate.m // iCarouselChameleonDemo // // Created by Nick Lockwood on 25/12/2011. // Copyright (c) 2011 __MyCompanyName__. All rights reserved. // #import "MacAppDelegate.h" #import "iCarouselExampleAppDelegate.h" @interface MacAppDelegate () @property (nonatomic, strong) iCarouselExampleAppDelegate *iPhoneAppDelegate; @end @implementation MacAppDelegate @synthesize window; @synthesize chameleonNSView; @synthesize iPhoneAppDelegate; - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { iPhoneAppDelegate = [[iCarouselExampleAppDelegate alloc] init]; [chameleonNSView launchApplicationWithDelegate:iPhoneAppDelegate afterDelay:1.0]; } @end ================================================ FILE: Examples/Chameleon Demo/iCarouselChameleonDemo/en.lproj/Credits.rtf ================================================ {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} {\colortbl;\red255\green255\blue255;} \paperw9840\paperh8400 \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural \f0\b\fs24 \cf0 Engineering: \b0 \ Some people\ \ \b Human Interface Design: \b0 \ Some other people\ \ \b Testing: \b0 \ Hopefully not nobody\ \ \b Documentation: \b0 \ Whoever\ \ \b With special thanks to: \b0 \ Mom\ } ================================================ FILE: Examples/Chameleon Demo/iCarouselChameleonDemo/en.lproj/InfoPlist.strings ================================================ /* Localized versions of Info.plist keys */ ================================================ FILE: Examples/Chameleon Demo/iCarouselChameleonDemo/en.lproj/MainMenu.xib ================================================ 1060 10K549 1938 1038.36 461.00 com.apple.InterfaceBuilder.CocoaPlugin 1938 NSCustomView NSWindowTemplate NSView NSMenu NSMenuItem NSCustomObject com.apple.InterfaceBuilder.CocoaPlugin PluginDependencyRecalculationVersion NSApplication FirstResponder NSApplication AMainMenu iCarouselChameleonDemo 1048576 2147483647 NSImage NSMenuCheckmark NSImage NSMenuMixedState submenuAction: iCarouselChameleonDemo About iCarouselChameleonDemo 2147483647 YES YES 1048576 2147483647 Preferences… , 1048576 2147483647 YES YES 1048576 2147483647 Services 1048576 2147483647 submenuAction: Services _NSServicesMenu YES YES 1048576 2147483647 Hide iCarouselChameleonDemo h 1048576 2147483647 Hide Others h 1572864 2147483647 Show All 1048576 2147483647 YES YES 1048576 2147483647 Quit iCarouselChameleonDemo q 1048576 2147483647 _NSAppleMenu File 1048576 2147483647 submenuAction: File New n 1048576 2147483647 Open… o 1048576 2147483647 Open Recent 1048576 2147483647 submenuAction: Open Recent Clear Menu 1048576 2147483647 _NSRecentDocumentsMenu YES YES 1048576 2147483647 Close w 1048576 2147483647 Save… s 1048576 2147483647 Revert to Saved 2147483647 YES YES 1048576 2147483647 Page Setup... P 1179648 2147483647 Print… p 1048576 2147483647 Edit 1048576 2147483647 submenuAction: Edit Undo z 1048576 2147483647 Redo Z 1179648 2147483647 YES YES 1048576 2147483647 Cut x 1048576 2147483647 Copy c 1048576 2147483647 Paste v 1048576 2147483647 Paste and Match Style V 1572864 2147483647 Delete 1048576 2147483647 Select All a 1048576 2147483647 YES YES 1048576 2147483647 Find 1048576 2147483647 submenuAction: Find Find… f 1048576 2147483647 1 Find and Replace… f 1572864 2147483647 12 Find Next g 1048576 2147483647 2 Find Previous G 1179648 2147483647 3 Use Selection for Find e 1048576 2147483647 7 Jump to Selection j 1048576 2147483647 Spelling and Grammar 1048576 2147483647 submenuAction: Spelling and Grammar Show Spelling and Grammar : 1048576 2147483647 Check Document Now ; 1048576 2147483647 YES YES 2147483647 Check Spelling While Typing 1048576 2147483647 Check Grammar With Spelling 1048576 2147483647 Correct Spelling Automatically 2147483647 Substitutions 1048576 2147483647 submenuAction: Substitutions Show Substitutions 2147483647 YES YES 2147483647 Smart Copy/Paste f 1048576 2147483647 1 Smart Quotes g 1048576 2147483647 2 Smart Dashes 2147483647 Smart Links G 1179648 2147483647 3 Text Replacement 2147483647 Transformations 2147483647 submenuAction: Transformations Make Upper Case 2147483647 Make Lower Case 2147483647 Capitalize 2147483647 Speech 1048576 2147483647 submenuAction: Speech Start Speaking 1048576 2147483647 Stop Speaking 1048576 2147483647 Format 2147483647 submenuAction: Format Font 2147483647 submenuAction: Font Show Fonts t 1048576 2147483647 Bold b 1048576 2147483647 2 Italic i 1048576 2147483647 1 Underline u 1048576 2147483647 YES YES 2147483647 Bigger + 1048576 2147483647 3 Smaller - 1048576 2147483647 4 YES YES 2147483647 Kern 2147483647 submenuAction: Kern Use Default 2147483647 Use None 2147483647 Tighten 2147483647 Loosen 2147483647 Ligature 2147483647 submenuAction: Ligature Use Default 2147483647 Use None 2147483647 Use All 2147483647 Baseline 2147483647 submenuAction: Baseline Use Default 2147483647 Superscript 2147483647 Subscript 2147483647 Raise 2147483647 Lower 2147483647 YES YES 2147483647 Show Colors C 1048576 2147483647 YES YES 2147483647 Copy Style c 1572864 2147483647 Paste Style v 1572864 2147483647 _NSFontMenu Text 2147483647 submenuAction: Text Align Left { 1048576 2147483647 Center | 1048576 2147483647 Justify 2147483647 Align Right } 1048576 2147483647 YES YES 2147483647 Writing Direction 2147483647 submenuAction: Writing Direction YES Paragraph 2147483647 CURlZmF1bHQ 2147483647 CUxlZnQgdG8gUmlnaHQ 2147483647 CVJpZ2h0IHRvIExlZnQ 2147483647 YES YES 2147483647 YES Selection 2147483647 CURlZmF1bHQ 2147483647 CUxlZnQgdG8gUmlnaHQ 2147483647 CVJpZ2h0IHRvIExlZnQ 2147483647 YES YES 2147483647 Show Ruler 2147483647 Copy Ruler c 1310720 2147483647 Paste Ruler v 1310720 2147483647 View 1048576 2147483647 submenuAction: View Show Toolbar t 1572864 2147483647 Customize Toolbar… 1048576 2147483647 Window 1048576 2147483647 submenuAction: Window Minimize m 1048576 2147483647 Zoom 1048576 2147483647 YES YES 1048576 2147483647 Bring All to Front 1048576 2147483647 _NSWindowsMenu Help 2147483647 submenuAction: Help iCarouselChameleonDemo Help ? 1048576 2147483647 _NSHelpMenu _NSMainMenu 15 2 {{335, 390}, {480, 360}} 1954021376 iCarouselChameleonDemo NSWindow 256 274 {480, 360} UIKitView {480, 360} {{0, 0}, {1440, 878}} {1e+13, 1e+13} MacAppDelegate NSFontManager terminate: 449 orderFrontStandardAboutPanel: 142 delegate 495 performMiniaturize: 37 arrangeInFront: 39 print: 86 runPageLayout: 87 clearRecentDocuments: 127 performClose: 193 toggleContinuousSpellChecking: 222 undo: 223 copy: 224 checkSpelling: 225 paste: 226 stopSpeaking: 227 cut: 228 showGuessPanel: 230 redo: 231 selectAll: 232 startSpeaking: 233 delete: 235 performZoom: 240 performFindPanelAction: 241 centerSelectionInVisibleArea: 245 toggleGrammarChecking: 347 toggleSmartInsertDelete: 355 toggleAutomaticQuoteSubstitution: 356 toggleAutomaticLinkDetection: 357 saveDocument: 362 revertDocumentToSaved: 364 runToolbarCustomizationPalette: 365 toggleToolbarShown: 366 hide: 367 hideOtherApplications: 368 unhideAllApplications: 370 newDocument: 373 openDocument: 374 raiseBaseline: 426 lowerBaseline: 427 copyFont: 428 subscript: 429 superscript: 430 tightenKerning: 431 underline: 432 orderFrontColorPanel: 433 useAllLigatures: 434 loosenKerning: 435 pasteFont: 436 unscript: 437 useStandardKerning: 438 useStandardLigatures: 439 turnOffLigatures: 440 turnOffKerning: 441 toggleAutomaticSpellingCorrection: 456 orderFrontSubstitutionsPanel: 458 toggleAutomaticDashSubstitution: 461 toggleAutomaticTextReplacement: 463 uppercaseWord: 464 capitalizeWord: 467 lowercaseWord: 468 pasteAsPlainText: 486 performFindPanelAction: 487 performFindPanelAction: 488 performFindPanelAction: 489 showHelp: 493 alignCenter: 518 pasteRuler: 519 toggleRuler: 520 alignRight: 521 copyRuler: 522 alignJustified: 523 alignLeft: 524 makeBaseWritingDirectionNatural: 525 makeBaseWritingDirectionLeftToRight: 526 makeBaseWritingDirectionRightToLeft: 527 makeTextWritingDirectionNatural: 528 makeTextWritingDirectionLeftToRight: 529 makeTextWritingDirectionRightToLeft: 530 performFindPanelAction: 535 addFontTrait: 421 addFontTrait: 422 modifyFont: 423 orderFrontFontPanel: 424 modifyFont: 425 window 532 chameleonNSView 538 0 -2 File's Owner -1 First Responder -3 Application 29 19 56 217 83 81 75 78 72 82 124 77 73 79 112 74 125 126 205 202 198 207 214 199 203 197 206 215 218 216 200 219 201 204 220 213 210 221 208 209 57 58 134 150 136 144 129 143 236 131 149 145 130 24 92 5 239 23 295 296 297 298 211 212 195 196 346 348 349 350 351 354 371 372 375 376 377 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 450 451 452 453 454 457 459 460 462 465 466 485 490 491 492 494 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 534 537 com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin {{380, 496}, {480, 360}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin 538 MacAppDelegate NSObject UIKitView NSWindow chameleonNSView UIKitView window NSWindow IBProjectSource ./Classes/MacAppDelegate.h NSDocument id id id id id id printDocument: id revertDocumentToSaved: id runPageLayout: id saveDocument: id saveDocumentAs: id saveDocumentTo: id IBProjectSource ./Classes/NSDocument.h UIKitView NSView IBProjectSource ./Classes/UIKitView.h WebView reloadFromOrigin: id reloadFromOrigin: reloadFromOrigin: id IBProjectSource ./Classes/WebView.h 0 IBCocoaFramework YES 3 {9, 8} {7, 2} ================================================ FILE: Examples/Chameleon Demo/iCarouselChameleonDemo/iCarouselChameleonDemo-Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIconFile CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1 LSMinimumSystemVersion ${MACOSX_DEPLOYMENT_TARGET} NSHumanReadableCopyright Copyright © 2011 __MyCompanyName__. All rights reserved. NSMainNibFile MainMenu NSPrincipalClass NSApplication ================================================ FILE: Examples/Chameleon Demo/iCarouselChameleonDemo/iCarouselChameleonDemo-Prefix.pch ================================================ // // Prefix header for all source files of the 'iCarouselChameleonDemo' target in the 'iCarouselChameleonDemo' project // #ifdef __OBJC__ #import #endif #import ================================================ FILE: Examples/Chameleon Demo/iCarouselChameleonDemo/iCarouselExampleAppDelegate.h ================================================ // // iCarouselExampleAppDelegate.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import @class iCarouselExampleViewController; @interface iCarouselExampleAppDelegate : NSObject @property (nonatomic, strong) IBOutlet UIWindow *window; @property (nonatomic, strong) iCarouselExampleViewController *viewController; @end ================================================ FILE: Examples/Chameleon Demo/iCarouselChameleonDemo/iCarouselExampleAppDelegate.m ================================================ // // iCarouselExampleAppDelegate.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleAppDelegate.h" #import "iCarouselExampleViewController.h" @implementation iCarouselExampleAppDelegate @synthesize window; @synthesize viewController; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; window.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; viewController = [[iCarouselExampleViewController alloc] init]; viewController.view.frame = window.screen.applicationFrame; viewController.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; [window addSubview:viewController.view]; [window makeKeyAndVisible]; return YES; } @end ================================================ FILE: Examples/Chameleon Demo/iCarouselChameleonDemo/iCarouselExampleViewController.h ================================================ // // iCarouselExampleViewController.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import @interface iCarouselExampleViewController : UIViewController @end ================================================ FILE: Examples/Chameleon Demo/iCarouselChameleonDemo/iCarouselExampleViewController.m ================================================ // // iCarouselExampleViewController.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleViewController.h" #import "iCarousel.h" @interface iCarouselExampleViewController () @property (nonatomic, strong) iCarousel *carousel; @property (nonatomic, strong) UINavigationItem *navItem; @property (nonatomic, assign) BOOL wrap; @property (nonatomic, strong) NSMutableArray *items; @end @implementation iCarouselExampleViewController @synthesize carousel; @synthesize navItem; @synthesize wrap; @synthesize items; - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { //set up data self.items = [NSMutableArray array]; for (int i = 0; i < 100; i++) { [items addObject:[NSNumber numberWithInt:i]]; } } return self; } - (void)dealloc { //it's a good idea to set these to nil here to avoid //sending messages to a deallocated viewcontroller carousel.delegate = nil; carousel.dataSource = nil; } #pragma mark - #pragma mark View lifecycle - (void)viewDidLoad { [super viewDidLoad]; wrap = YES; //add background UIImageView *backgroundView = [[UIImageView alloc] initWithFrame:self.view.bounds]; backgroundView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; backgroundView.image = [UIImage imageNamed:@"background.png"]; [self.view addSubview:backgroundView]; //create carousel carousel = [[iCarousel alloc] initWithFrame:self.view.bounds]; carousel.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; carousel.type = iCarouselTypeCoverFlow2; carousel.delegate = self; carousel.dataSource = self; //add carousel to view [self.view addSubview:carousel]; //add top bar UINavigationBar *navbar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 44)]; navbar.autoresizingMask = UIViewAutoresizingFlexibleWidth; self.navItem = [[UINavigationItem alloc] initWithTitle:@"Coverflow2"]; navItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Switch Type" style:UIBarButtonItemStyleBordered target:self action:@selector(switchCarouselType)]; navItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Wrap: ON" style:UIBarButtonItemStyleBordered target:self action:@selector(toggleWrap)]; [navbar setItems:[NSArray arrayWithObject:navItem]]; [self.view addSubview:navbar]; //add bottom bar UIToolbar *toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, self.view.bounds.size.height - 44, self.view.bounds.size.width, 44)]; toolbar.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin; [toolbar setItems:[NSArray arrayWithObjects: [[UIBarButtonItem alloc] initWithTitle:@"Insert Item" style:UIBarButtonItemStyleBordered target:self action:@selector(insertItem)], [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:NULL], [[UIBarButtonItem alloc] initWithTitle:@"Delete Item" style:UIBarButtonItemStyleBordered target:self action:@selector(removeItem)], nil]]; [self.view addSubview:toolbar]; } - (void)viewDidUnload { [super viewDidUnload]; self.carousel = nil; self.navItem = nil; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } - (NSArray *)carouselTypes { return [NSArray arrayWithObjects:@"Linear", @"Rotary", @"Inverted Rotary", @"Cylinder", @"Inverted Cylinder", @"Wheel", @"Inverted Wheel", @"CoverFlow", @"CoverFlow2", @"Time Machine", @"Inverted Time Machine", @"Custom", nil]; } - (IBAction)switchCarouselType { UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@"Select Carousel Type" delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil]; for (NSString *title in [self carouselTypes]) { [sheet addButtonWithTitle:title]; } [sheet showInView:self.view]; } - (IBAction)toggleWrap { wrap = !wrap; navItem.rightBarButtonItem.title = wrap? @"Wrap: ON": @"Wrap: OFF"; [carousel reloadData]; } - (IBAction)insertItem { NSInteger index = carousel.currentItemIndex; [items insertObject:[NSNumber numberWithInteger:carousel.numberOfItems] atIndex:index]; [carousel insertItemAtIndex:index animated:YES]; } - (IBAction)removeItem { if (carousel.numberOfItems > 0) { NSInteger index = carousel.currentItemIndex; [carousel removeItemAtIndex:index animated:YES]; [items removeObjectAtIndex:index]; } } #pragma mark - #pragma mark UIActionSheet methods - (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex { if (buttonIndex >= 0) { carousel.type = (iCarouselType)buttonIndex; navItem.title = [[self carouselTypes] objectAtIndex:buttonIndex]; } } #pragma mark - #pragma mark iCarousel methods - (NSInteger)numberOfItemsInCarousel:(iCarousel *)carousel { return [items count]; } - (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view { UILabel *label = nil; //create new view if no view is available for recycling if (view == nil) { view = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 200.0f, 200.0f)]; ((UIImageView *)view).image = [UIImage imageNamed:@"page.png"]; view.contentMode = UIViewContentModeCenter; label = [[UILabel alloc] initWithFrame:view.bounds]; label.backgroundColor = [UIColor clearColor]; label.textAlignment = UITextAlignmentCenter; label.font = [label.font fontWithSize:50]; [view addSubview:label]; } else { label = [[view subviews] lastObject]; } //set label label.text = [[items objectAtIndex:index] stringValue]; return view; } - (UIView *)carousel:(iCarousel *)carousel placeholderViewAtIndex:(NSInteger)index reusingView:(UIView *)view { UILabel *label = nil; //create new view if no view is available for recycling if (view == nil) { view = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"page.png"]]; label = [[UILabel alloc] initWithFrame:view.bounds]; label.backgroundColor = [UIColor clearColor]; label.textAlignment = UITextAlignmentCenter; label.font = [label.font fontWithSize:50.0f]; [view addSubview:label]; } else { label = [[view subviews] lastObject]; } //set label label.text = (index == 0)? @"[": @"]"; return view; } - (CATransform3D)carousel:(iCarousel *)_carousel itemTransformForOffset:(CGFloat)offset baseTransform:(CATransform3D)transform { //implement 'flip3D' style carousel transform = CATransform3DRotate(transform, M_PI / 8.0f, 0.0f, 1.0f, 0.0f); return CATransform3DTranslate(transform, 0.0f, 0.0f, offset * carousel.itemWidth); } - (CGFloat)carousel:(iCarousel *)_carousel valueForOption:(iCarouselOption)option withDefault:(CGFloat)value { //customize carousel display switch (option) { case iCarouselOptionWrap: { //normally you would hard-code this to YES or NO return wrap; } case iCarouselOptionSpacing: { //add a bit of spacing between the item views return value * 1.05f; } case iCarouselOptionFadeMax: { if (carousel.type == iCarouselTypeCustom) { //set opacity based on distance from camera return 0.0f; } return value; } default: { return value; } } } @end ================================================ FILE: Examples/Chameleon Demo/iCarouselChameleonDemo/main.m ================================================ // // main.m // iCarouselChameleonDemo // // Created by Nick Lockwood on 25/12/2011. // Copyright (c) 2011 __MyCompanyName__. All rights reserved. // #import int main(int argc, char *argv[]) { return NSApplicationMain(argc, (const char **)argv); } ================================================ FILE: Examples/Chameleon Demo/iCarouselChameleonDemo.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 0153203C14A71F0000C4A088 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0153203B14A71F0000C4A088 /* Cocoa.framework */; }; 0153204614A71F0100C4A088 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0153204414A71F0100C4A088 /* InfoPlist.strings */; }; 0153204814A71F0100C4A088 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0153204714A71F0100C4A088 /* main.m */; }; 0153204C14A71F0100C4A088 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 0153204A14A71F0100C4A088 /* Credits.rtf */; }; 0153204F14A71F0100C4A088 /* MacAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0153204E14A71F0100C4A088 /* MacAppDelegate.m */; }; 0153205214A71F0200C4A088 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0153205014A71F0200C4A088 /* MainMenu.xib */; }; 015322E214A71FCA00C4A088 /* iCarousel.m in Sources */ = {isa = PBXBuildFile; fileRef = 0153220614A71FC700C4A088 /* iCarousel.m */; }; 0153230C14A7F50200C4A088 /* iCarouselExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0153230814A7F50200C4A088 /* iCarouselExampleViewController.m */; }; 0153230D14A7F50200C4A088 /* iCarouselExampleAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0153230914A7F50200C4A088 /* iCarouselExampleAppDelegate.m */; }; 0153231114A7F5D800C4A088 /* background.png in Resources */ = {isa = PBXBuildFile; fileRef = 0153230F14A7F5D800C4A088 /* background.png */; }; 0153231214A7F5D800C4A088 /* page.png in Resources */ = {isa = PBXBuildFile; fileRef = 0153231014A7F5D800C4A088 /* page.png */; }; 0153231414A7F78000C4A088 /* Quartz.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0153231314A7F78000C4A088 /* Quartz.framework */; }; 0153233214A7FB5D00C4A088 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0153233114A7FB5D00C4A088 /* QuartzCore.framework */; }; B2FC80CB14A94A050075C520 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0153232314A7F9FE00C4A088 /* UIKit.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ 0153232214A7F9FE00C4A088 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 0153231E14A7F9FD00C4A088 /* UIKit.xcodeproj */; proxyType = 2; remoteGlobalIDString = 8DC2EF5B0486A6940098B216; remoteInfo = UIKit; }; 0153232F14A7FB3C00C4A088 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 0153231E14A7F9FD00C4A088 /* UIKit.xcodeproj */; proxyType = 1; remoteGlobalIDString = 8DC2EF4F0486A6940098B216; remoteInfo = UIKit; }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ 0153203714A71F0000C4A088 /* iCarouselChameleonDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iCarouselChameleonDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 0153203B14A71F0000C4A088 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; 0153203E14A71F0000C4A088 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; 0153203F14A71F0000C4A088 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; 0153204014A71F0000C4A088 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 0153204314A71F0000C4A088 /* iCarouselChameleonDemo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "iCarouselChameleonDemo-Info.plist"; sourceTree = ""; }; 0153204514A71F0100C4A088 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 0153204714A71F0100C4A088 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 0153204914A71F0100C4A088 /* iCarouselChameleonDemo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "iCarouselChameleonDemo-Prefix.pch"; sourceTree = ""; }; 0153204B14A71F0100C4A088 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/Credits.rtf; sourceTree = ""; }; 0153204D14A71F0100C4A088 /* MacAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MacAppDelegate.h; sourceTree = ""; }; 0153204E14A71F0100C4A088 /* MacAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MacAppDelegate.m; sourceTree = ""; }; 0153205114A71F0200C4A088 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = ""; }; 0153220514A71FC700C4A088 /* iCarousel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarousel.h; sourceTree = ""; }; 0153220614A71FC700C4A088 /* iCarousel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarousel.m; sourceTree = ""; }; 0153230814A7F50200C4A088 /* iCarouselExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleViewController.m; sourceTree = ""; }; 0153230914A7F50200C4A088 /* iCarouselExampleAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleAppDelegate.m; sourceTree = ""; }; 0153230A14A7F50200C4A088 /* iCarouselExampleAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleAppDelegate.h; sourceTree = ""; }; 0153230B14A7F50200C4A088 /* iCarouselExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleViewController.h; sourceTree = ""; }; 0153230F14A7F5D800C4A088 /* background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = background.png; sourceTree = ""; }; 0153231014A7F5D800C4A088 /* page.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = page.png; sourceTree = ""; }; 0153231314A7F78000C4A088 /* Quartz.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quartz.framework; path = System/Library/Frameworks/Quartz.framework; sourceTree = SDKROOT; }; 0153231E14A7F9FD00C4A088 /* UIKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = UIKit.xcodeproj; path = Chameleon/UIKit/UIKit.xcodeproj; sourceTree = ""; }; 0153233114A7FB5D00C4A088 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 0153203414A71F0000C4A088 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( B2FC80CB14A94A050075C520 /* UIKit.framework in Frameworks */, 0153233214A7FB5D00C4A088 /* QuartzCore.framework in Frameworks */, 0153231414A7F78000C4A088 /* Quartz.framework in Frameworks */, 0153203C14A71F0000C4A088 /* Cocoa.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 0153202C14A71EFF00C4A088 = { isa = PBXGroup; children = ( 0153232414A7FA1500C4A088 /* Chameleon */, 0153220414A71FC700C4A088 /* iCarousel */, 0153204114A71F0000C4A088 /* iCarouselChameleonDemo */, 0153203A14A71F0000C4A088 /* Frameworks */, 0153203814A71F0000C4A088 /* Products */, ); indentWidth = 4; sourceTree = ""; tabWidth = 4; }; 0153203814A71F0000C4A088 /* Products */ = { isa = PBXGroup; children = ( 0153203714A71F0000C4A088 /* iCarouselChameleonDemo.app */, ); name = Products; sourceTree = ""; }; 0153203A14A71F0000C4A088 /* Frameworks */ = { isa = PBXGroup; children = ( 0153233114A7FB5D00C4A088 /* QuartzCore.framework */, 0153231314A7F78000C4A088 /* Quartz.framework */, 0153203B14A71F0000C4A088 /* Cocoa.framework */, 0153203D14A71F0000C4A088 /* Other Frameworks */, ); name = Frameworks; sourceTree = ""; }; 0153203D14A71F0000C4A088 /* Other Frameworks */ = { isa = PBXGroup; children = ( 0153203E14A71F0000C4A088 /* AppKit.framework */, 0153203F14A71F0000C4A088 /* CoreData.framework */, 0153204014A71F0000C4A088 /* Foundation.framework */, ); name = "Other Frameworks"; sourceTree = ""; }; 0153204114A71F0000C4A088 /* iCarouselChameleonDemo */ = { isa = PBXGroup; children = ( 0153204D14A71F0100C4A088 /* MacAppDelegate.h */, 0153204E14A71F0100C4A088 /* MacAppDelegate.m */, 0153230A14A7F50200C4A088 /* iCarouselExampleAppDelegate.h */, 0153230914A7F50200C4A088 /* iCarouselExampleAppDelegate.m */, 0153230B14A7F50200C4A088 /* iCarouselExampleViewController.h */, 0153230814A7F50200C4A088 /* iCarouselExampleViewController.m */, 0153205014A71F0200C4A088 /* MainMenu.xib */, 0153230E14A7F5D800C4A088 /* Resources */, 0153204214A71F0000C4A088 /* Supporting Files */, ); path = iCarouselChameleonDemo; sourceTree = ""; }; 0153204214A71F0000C4A088 /* Supporting Files */ = { isa = PBXGroup; children = ( 0153204314A71F0000C4A088 /* iCarouselChameleonDemo-Info.plist */, 0153204414A71F0100C4A088 /* InfoPlist.strings */, 0153204714A71F0100C4A088 /* main.m */, 0153204914A71F0100C4A088 /* iCarouselChameleonDemo-Prefix.pch */, 0153204A14A71F0100C4A088 /* Credits.rtf */, ); name = "Supporting Files"; sourceTree = ""; }; 0153220414A71FC700C4A088 /* iCarousel */ = { isa = PBXGroup; children = ( 0153220514A71FC700C4A088 /* iCarousel.h */, 0153220614A71FC700C4A088 /* iCarousel.m */, ); name = iCarousel; path = ../../iCarousel; sourceTree = ""; }; 0153230E14A7F5D800C4A088 /* Resources */ = { isa = PBXGroup; children = ( 0153230F14A7F5D800C4A088 /* background.png */, 0153231014A7F5D800C4A088 /* page.png */, ); name = Resources; path = ../../Resources; sourceTree = ""; }; 0153231F14A7F9FD00C4A088 /* Products */ = { isa = PBXGroup; children = ( 0153232314A7F9FE00C4A088 /* UIKit.framework */, ); name = Products; sourceTree = ""; }; 0153232414A7FA1500C4A088 /* Chameleon */ = { isa = PBXGroup; children = ( 0153231E14A7F9FD00C4A088 /* UIKit.xcodeproj */, ); name = Chameleon; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 0153203614A71F0000C4A088 /* iCarouselChameleonDemo */ = { isa = PBXNativeTarget; buildConfigurationList = 0153205514A71F0200C4A088 /* Build configuration list for PBXNativeTarget "iCarouselChameleonDemo" */; buildPhases = ( 0153203314A71F0000C4A088 /* Sources */, 0153203414A71F0000C4A088 /* Frameworks */, 0153203514A71F0000C4A088 /* Resources */, ); buildRules = ( ); dependencies = ( 0153233014A7FB3C00C4A088 /* PBXTargetDependency */, ); name = iCarouselChameleonDemo; productName = iCarouselChameleonDemo; productReference = 0153203714A71F0000C4A088 /* iCarouselChameleonDemo.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 0153202E14A71EFF00C4A088 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0800; }; buildConfigurationList = 0153203114A71EFF00C4A088 /* Build configuration list for PBXProject "iCarouselChameleonDemo" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, English, ); mainGroup = 0153202C14A71EFF00C4A088; productRefGroup = 0153203814A71F0000C4A088 /* Products */; projectDirPath = ""; projectReferences = ( { ProductGroup = 0153231F14A7F9FD00C4A088 /* Products */; ProjectRef = 0153231E14A7F9FD00C4A088 /* UIKit.xcodeproj */; }, ); projectRoot = ""; targets = ( 0153203614A71F0000C4A088 /* iCarouselChameleonDemo */, ); }; /* End PBXProject section */ /* Begin PBXReferenceProxy section */ 0153232314A7F9FE00C4A088 /* UIKit.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; path = UIKit.framework; remoteRef = 0153232214A7F9FE00C4A088 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXReferenceProxy section */ /* Begin PBXResourcesBuildPhase section */ 0153203514A71F0000C4A088 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 0153204614A71F0100C4A088 /* InfoPlist.strings in Resources */, 0153204C14A71F0100C4A088 /* Credits.rtf in Resources */, 0153205214A71F0200C4A088 /* MainMenu.xib in Resources */, 0153231114A7F5D800C4A088 /* background.png in Resources */, 0153231214A7F5D800C4A088 /* page.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 0153203314A71F0000C4A088 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 0153204814A71F0100C4A088 /* main.m in Sources */, 0153204F14A71F0100C4A088 /* MacAppDelegate.m in Sources */, 015322E214A71FCA00C4A088 /* iCarousel.m in Sources */, 0153230C14A7F50200C4A088 /* iCarouselExampleViewController.m in Sources */, 0153230D14A7F50200C4A088 /* iCarouselExampleAppDelegate.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ 0153233014A7FB3C00C4A088 /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = UIKit; targetProxy = 0153232F14A7FB3C00C4A088 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ 0153204414A71F0100C4A088 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( 0153204514A71F0100C4A088 /* en */, ); name = InfoPlist.strings; sourceTree = ""; }; 0153204A14A71F0100C4A088 /* Credits.rtf */ = { isa = PBXVariantGroup; children = ( 0153204B14A71F0100C4A088 /* en */, ); name = Credits.rtf; sourceTree = ""; }; 0153205014A71F0200C4A088 /* MainMenu.xib */ = { isa = PBXVariantGroup; children = ( 0153205114A71F0200C4A088 /* en */, ); name = MainMenu.xib; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 0153205314A71F0200C4A088 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_OBJC_EXCEPTIONS = YES; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.7; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; }; name = Debug; }; 0153205414A71F0200C4A088 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_ENABLE_OBJC_EXCEPTIONS = YES; GCC_NO_COMMON_BLOCKS = YES; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.7; SDKROOT = macosx; }; name = Release; }; 0153205614A71F0200C4A088 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_OBJC_ARC = YES; COMBINE_HIDPI_IMAGES = YES; FRAMEWORK_SEARCH_PATHS = ""; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselChameleonDemo/iCarouselChameleonDemo-Prefix.pch"; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", USING_CHAMELEON, ); HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = "iCarouselChameleonDemo/iCarouselChameleonDemo-Info.plist"; MACOSX_DEPLOYMENT_TARGET = 10.6.8; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; name = Debug; }; 0153205714A71F0200C4A088 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_OBJC_ARC = YES; COMBINE_HIDPI_IMAGES = YES; FRAMEWORK_SEARCH_PATHS = ""; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselChameleonDemo/iCarouselChameleonDemo-Prefix.pch"; GCC_PREPROCESSOR_DEFINITIONS = USING_CHAMELEON; HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = "iCarouselChameleonDemo/iCarouselChameleonDemo-Info.plist"; MACOSX_DEPLOYMENT_TARGET = 10.6.8; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 0153203114A71EFF00C4A088 /* Build configuration list for PBXProject "iCarouselChameleonDemo" */ = { isa = XCConfigurationList; buildConfigurations = ( 0153205314A71F0200C4A088 /* Debug */, 0153205414A71F0200C4A088 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 0153205514A71F0200C4A088 /* Build configuration list for PBXNativeTarget "iCarouselChameleonDemo" */ = { isa = XCConfigurationList; buildConfigurations = ( 0153205614A71F0200C4A088 /* Debug */, 0153205714A71F0200C4A088 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 0153202E14A71EFF00C4A088 /* Project object */; } ================================================ FILE: Examples/Chameleon Demo/iCarouselChameleonDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: Examples/Controls Demo/ItemView.xib ================================================ 1552 12E55 3084 1187.39 626.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin 2083 IBProxyObject IBUIButton IBUIImageView IBUISlider IBUISwitch IBUIView com.apple.InterfaceBuilder.IBCocoaTouchPlugin PluginDependencyRecalculationVersion IBFilesOwner IBCocoaTouchFramework IBFirstResponder IBCocoaTouchFramework 274 256 {{-20, -90}, {240, 380}} NO YES 4 YES IBCocoaTouchFramework NSImage page.png 293 {{20, 20}, {160, 37}} _NS:225 NO IBCocoaTouchFramework 0 0 1 Press me! 3 MQA 1 MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA 3 MC41AA 2 15 Helvetica-Bold 15 16 293 {{46, 86}, {94, 27}} _NS:606 NO IBCocoaTouchFramework 0 0 YES 293 {{41, 146}, {118, 23}} _NS:623 NO IBCocoaTouchFramework 0 0 0.5 {200, 200} 3 MQA 2 IBCocoaTouchFramework pressedButton: 7 6 toggledSwitch: 13 7 changedSlider: 13 8 0 1 -1 File's Owner -2 3 4 5 9 iCarouselExampleViewController com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIResponder com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin 9 iCarousel UIView id id dataSource id delegate id IBProjectSource ./Classes/iCarousel.h iCarouselExampleViewController UIViewController id id id changedSlider: id pressedButton: id toggledSwitch: id iCarousel UILabel carousel iCarousel label UILabel IBProjectSource ./Classes/iCarouselExampleViewController.h 0 IBCocoaTouchFramework YES 3 page.png {240, 380} 2083 ================================================ FILE: Examples/Controls Demo/en.lproj/InfoPlist.strings ================================================ /* Localized versions of Info.plist keys */ ================================================ FILE: Examples/Controls Demo/en.lproj/MainWindow.xib ================================================ 1024 10D571 786 1038.29 460.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin 112 YES YES com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES YES YES IBFilesOwner IBCocoaTouchFramework IBFirstResponder IBCocoaTouchFramework IBCocoaTouchFramework iCarouselExampleViewController 1 IBCocoaTouchFramework NO 292 {320, 480} 1 MSAxIDEAA NO NO IBCocoaTouchFramework YES YES delegate 4 viewController 11 window 14 YES 0 -1 File's Owner 3 iCarouselExample App Delegate -2 10 12 YES YES -1.CustomClassName -2.CustomClassName 10.CustomClassName 10.IBEditorWindowLastContentRect 10.IBPluginDependency 12.IBEditorWindowLastContentRect 12.IBPluginDependency 3.CustomClassName 3.IBPluginDependency YES UIApplication UIResponder iCarouselExampleViewController {{234, 376}, {320, 480}} com.apple.InterfaceBuilder.IBCocoaTouchPlugin {{525, 346}, {320, 480}} com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarouselExampleAppDelegate com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES YES YES 15 YES UIWindow UIView IBUserSource iCarouselExampleAppDelegate NSObject YES YES viewController window YES iCarouselExampleViewController UIWindow YES YES viewController window YES viewController iCarouselExampleViewController window UIWindow IBProjectSource iCarouselExampleAppDelegate.h iCarouselExampleAppDelegate NSObject IBUserSource iCarouselExampleViewController UIViewController IBProjectSource iCarouselExampleViewController.h YES NSObject IBFrameworkSource Foundation.framework/Headers/NSError.h NSObject IBFrameworkSource Foundation.framework/Headers/NSFileManager.h NSObject IBFrameworkSource Foundation.framework/Headers/NSKeyValueCoding.h NSObject IBFrameworkSource Foundation.framework/Headers/NSKeyValueObserving.h NSObject IBFrameworkSource Foundation.framework/Headers/NSKeyedArchiver.h NSObject IBFrameworkSource Foundation.framework/Headers/NSObject.h NSObject IBFrameworkSource Foundation.framework/Headers/NSRunLoop.h NSObject IBFrameworkSource Foundation.framework/Headers/NSThread.h NSObject IBFrameworkSource Foundation.framework/Headers/NSURL.h NSObject IBFrameworkSource Foundation.framework/Headers/NSURLConnection.h NSObject IBFrameworkSource UIKit.framework/Headers/UIAccessibility.h NSObject IBFrameworkSource UIKit.framework/Headers/UINibLoading.h NSObject IBFrameworkSource UIKit.framework/Headers/UIResponder.h UIApplication UIResponder IBFrameworkSource UIKit.framework/Headers/UIApplication.h UIResponder NSObject UISearchBar UIView IBFrameworkSource UIKit.framework/Headers/UISearchBar.h UISearchDisplayController NSObject IBFrameworkSource UIKit.framework/Headers/UISearchDisplayController.h UIView IBFrameworkSource UIKit.framework/Headers/UITextField.h UIView UIResponder IBFrameworkSource UIKit.framework/Headers/UIView.h UIViewController IBFrameworkSource UIKit.framework/Headers/UINavigationController.h UIViewController IBFrameworkSource UIKit.framework/Headers/UIPopoverController.h UIViewController IBFrameworkSource UIKit.framework/Headers/UISplitViewController.h UIViewController IBFrameworkSource UIKit.framework/Headers/UITabBarController.h UIViewController UIResponder IBFrameworkSource UIKit.framework/Headers/UIViewController.h UIWindow UIView IBFrameworkSource UIKit.framework/Headers/UIWindow.h 0 IBCocoaTouchFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 YES iCarouselExample.xcodeproj 3 112 ================================================ FILE: Examples/Controls Demo/en.lproj/iCarouselExampleViewController.xib ================================================ 1552 12E55 3084 1187.39 626.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin 2083 YES IBProxyObject IBUIImageView IBUILabel IBUIView YES com.apple.InterfaceBuilder.IBCocoaTouchPlugin PluginDependencyRecalculationVersion YES IBFilesOwner IBCocoaTouchFramework IBFirstResponder IBCocoaTouchFramework 274 YES 274 {320, 480} NO YES YES IBCocoaTouchFramework NSImage background.png 274 {320, 480} 3 MSAwAA 2 IBCocoaTouchFramework 298 {{20, 362}, {280, 21}} _NS:328 NO YES 7 NO IBCocoaTouchFramework 3 MQA 1 10 1 1 17 Helvetica 17 16 {320, 480} NO IBCocoaTouchFramework YES view 7 carousel 9 label 37 dataSource 10 delegate 11 YES 0 YES -1 File's Owner -2 6 YES 8 YES iCarousel 35 36 YES YES -1.CustomClassName -1.IBPluginDependency -2.CustomClassName -2.IBPluginDependency 35.IBPluginDependency 36.IBPluginDependency 6.IBPluginDependency 8.CustomClassName 8.IBPluginDependency YES iCarouselExampleViewController com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIResponder com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarousel com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES 37 YES iCarousel UIView YES YES dataSource delegate YES id id YES YES dataSource delegate YES dataSource id delegate id IBProjectSource ./Classes/iCarousel.h iCarouselExampleViewController UIViewController YES YES changedSlider: pressedButton: toggledSwitch: YES id id id YES YES changedSlider: pressedButton: toggledSwitch: YES changedSlider: id pressedButton: id toggledSwitch: id YES YES carousel label YES iCarousel UILabel YES YES carousel label YES carousel iCarousel label UILabel IBProjectSource ./Classes/iCarouselExampleViewController.h 0 IBCocoaTouchFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 YES 3 background.png {50, 468} 2083 ================================================ FILE: Examples/Controls Demo/iCarouselControlsDemo.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 01308D9313491C3500453707 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9213491C3500453707 /* UIKit.framework */; }; 01308D9513491C3500453707 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9413491C3500453707 /* Foundation.framework */; }; 01308D9713491C3500453707 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9613491C3500453707 /* CoreGraphics.framework */; }; 01308DC013491F7200453707 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308DBF13491F7200453707 /* QuartzCore.framework */; }; 0148358813A36C2000E687AC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358313A36C2000E687AC /* main.m */; }; 0148359313A36C3700E687AC /* iCarouselExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */; }; 0148359413A36C3700E687AC /* iCarouselExampleAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */; }; 0148359513A36C3700E687AC /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0148358F13A36C3700E687AC /* MainWindow.xib */; }; 0148359613A36C3700E687AC /* iCarouselExampleViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */; }; 0153202914A6A2B200C4A088 /* background.png in Resources */ = {isa = PBXBuildFile; fileRef = 0153202714A6A2B200C4A088 /* background.png */; }; 0153202A14A6A2B200C4A088 /* page.png in Resources */ = {isa = PBXBuildFile; fileRef = 0153202814A6A2B200C4A088 /* page.png */; }; 018AE98F179D841B00FB7311 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 018AE98E179D841B00FB7311 /* Default-568h@2x.png */; }; 01F7B75014636C7A00F0AE19 /* ItemView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 01F7B74F14636C7A00F0AE19 /* ItemView.xib */; }; B2E5E749146155E300EADB7A /* iCarousel.m in Sources */ = {isa = PBXBuildFile; fileRef = B2E5E748146155E300EADB7A /* iCarousel.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 01308D9213491C3500453707 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 01308D9413491C3500453707 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 01308D9613491C3500453707 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 01308DBF13491F7200453707 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 0148358313A36C2000E687AC /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = SOURCE_ROOT; }; 0148358413A36C2000E687AC /* iCarouselTest-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "iCarouselTest-Prefix.pch"; sourceTree = SOURCE_ROOT; }; 0148358513A36C2000E687AC /* iCarouselTest-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "iCarouselTest-Info.plist"; sourceTree = SOURCE_ROOT; }; 0148358713A36C2000E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = SOURCE_ROOT; }; 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleViewController.m; sourceTree = SOURCE_ROOT; }; 0148358C13A36C3700E687AC /* iCarouselExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleViewController.h; sourceTree = SOURCE_ROOT; }; 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleAppDelegate.m; sourceTree = SOURCE_ROOT; }; 0148358E13A36C3700E687AC /* iCarouselExampleAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleAppDelegate.h; sourceTree = SOURCE_ROOT; }; 0148359013A36C3700E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainWindow.xib; sourceTree = SOURCE_ROOT; }; 0148359213A36C3700E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/iCarouselExampleViewController.xib; sourceTree = SOURCE_ROOT; }; 0153202714A6A2B200C4A088 /* background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = background.png; path = ../Resources/background.png; sourceTree = SOURCE_ROOT; }; 0153202814A6A2B200C4A088 /* page.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = page.png; path = ../Resources/page.png; sourceTree = SOURCE_ROOT; }; 018AE98E179D841B00FB7311 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = SOURCE_ROOT; }; 018BBCB413A375AF005CA505 /* ControlsDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ControlsDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 01F7B74F14636C7A00F0AE19 /* ItemView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ItemView.xib; sourceTree = SOURCE_ROOT; }; B2E5E747146155E300EADB7A /* iCarousel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarousel.h; sourceTree = ""; }; B2E5E748146155E300EADB7A /* iCarousel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarousel.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 01308D8B13491C3500453707 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 01308DC013491F7200453707 /* QuartzCore.framework in Frameworks */, 01308D9313491C3500453707 /* UIKit.framework in Frameworks */, 01308D9513491C3500453707 /* Foundation.framework in Frameworks */, 01308D9713491C3500453707 /* CoreGraphics.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 01308D8313491C3500453707 = { isa = PBXGroup; children = ( B2E5E746146155E300EADB7A /* iCarousel */, 01308D9813491C3500453707 /* iCarouselControlsDemo */, 01308D9113491C3500453707 /* Frameworks */, 01308D8F13491C3500453707 /* Products */, ); sourceTree = ""; }; 01308D8F13491C3500453707 /* Products */ = { isa = PBXGroup; children = ( 018BBCB413A375AF005CA505 /* ControlsDemo.app */, ); name = Products; sourceTree = ""; }; 01308D9113491C3500453707 /* Frameworks */ = { isa = PBXGroup; children = ( 01308DBF13491F7200453707 /* QuartzCore.framework */, 01308D9213491C3500453707 /* UIKit.framework */, 01308D9413491C3500453707 /* Foundation.framework */, 01308D9613491C3500453707 /* CoreGraphics.framework */, ); name = Frameworks; sourceTree = ""; }; 01308D9813491C3500453707 /* iCarouselControlsDemo */ = { isa = PBXGroup; children = ( 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */, 0148358C13A36C3700E687AC /* iCarouselExampleViewController.h */, 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */, 0148358E13A36C3700E687AC /* iCarouselExampleAppDelegate.h */, 0148358F13A36C3700E687AC /* MainWindow.xib */, 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */, 01F7B74F14636C7A00F0AE19 /* ItemView.xib */, 0153202614A6A2B200C4A088 /* Resources */, 01308D9913491C3500453707 /* Supporting Files */, ); name = iCarouselControlsDemo; path = iCarouselExample; sourceTree = ""; }; 01308D9913491C3500453707 /* Supporting Files */ = { isa = PBXGroup; children = ( 018AE98E179D841B00FB7311 /* Default-568h@2x.png */, 0148358313A36C2000E687AC /* main.m */, 0148358413A36C2000E687AC /* iCarouselTest-Prefix.pch */, 0148358513A36C2000E687AC /* iCarouselTest-Info.plist */, 0148358613A36C2000E687AC /* InfoPlist.strings */, ); name = "Supporting Files"; sourceTree = ""; }; 0153202614A6A2B200C4A088 /* Resources */ = { isa = PBXGroup; children = ( 0153202714A6A2B200C4A088 /* background.png */, 0153202814A6A2B200C4A088 /* page.png */, ); name = Resources; path = ../../Resources; sourceTree = ""; }; B2E5E746146155E300EADB7A /* iCarousel */ = { isa = PBXGroup; children = ( B2E5E747146155E300EADB7A /* iCarousel.h */, B2E5E748146155E300EADB7A /* iCarousel.m */, ); name = iCarousel; path = ../../iCarousel; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 01308D8D13491C3500453707 /* ControlsDemo */ = { isa = PBXNativeTarget; buildConfigurationList = 01308DAF13491C3500453707 /* Build configuration list for PBXNativeTarget "ControlsDemo" */; buildPhases = ( 01308D8A13491C3500453707 /* Sources */, 01308D8B13491C3500453707 /* Frameworks */, 01308D8C13491C3500453707 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = ControlsDemo; productName = ControlsDemo; productReference = 018BBCB413A375AF005CA505 /* ControlsDemo.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 01308D8513491C3500453707 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0600; }; buildConfigurationList = 01308D8813491C3500453707 /* Build configuration list for PBXProject "iCarouselControlsDemo" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); mainGroup = 01308D8313491C3500453707; productRefGroup = 01308D8F13491C3500453707 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 01308D8D13491C3500453707 /* ControlsDemo */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 01308D8C13491C3500453707 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 0148359513A36C3700E687AC /* MainWindow.xib in Resources */, 0148359613A36C3700E687AC /* iCarouselExampleViewController.xib in Resources */, 01F7B75014636C7A00F0AE19 /* ItemView.xib in Resources */, 0153202914A6A2B200C4A088 /* background.png in Resources */, 0153202A14A6A2B200C4A088 /* page.png in Resources */, 018AE98F179D841B00FB7311 /* Default-568h@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 01308D8A13491C3500453707 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 0148358813A36C2000E687AC /* main.m in Sources */, 0148359313A36C3700E687AC /* iCarouselExampleViewController.m in Sources */, 0148359413A36C3700E687AC /* iCarouselExampleAppDelegate.m in Sources */, B2E5E749146155E300EADB7A /* iCarousel.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 0148358613A36C2000E687AC /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( 0148358713A36C2000E687AC /* en */, ); name = InfoPlist.strings; sourceTree = ""; }; 0148358F13A36C3700E687AC /* MainWindow.xib */ = { isa = PBXVariantGroup; children = ( 0148359013A36C3700E687AC /* en */, ); name = MainWindow.xib; sourceTree = ""; }; 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */ = { isa = PBXVariantGroup; children = ( 0148359213A36C3700E687AC /* en */, ); name = iCarouselExampleViewController.xib; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 01308DAD13491C3500453707 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = DEBUG; GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 4.2; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; }; name = Debug; }; 01308DAE13491C3500453707 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 4.2; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; SDKROOT = iphoneos; }; name = Release; }; 01308DB013491C3500453707 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselTest-Prefix.pch"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = "iCarouselTest-Info.plist"; PRODUCT_NAME = ControlsDemo; TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = app; }; name = Debug; }; 01308DB113491C3500453707 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselTest-Prefix.pch"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = "iCarouselTest-Info.plist"; PRODUCT_NAME = ControlsDemo; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; WRAPPER_EXTENSION = app; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 01308D8813491C3500453707 /* Build configuration list for PBXProject "iCarouselControlsDemo" */ = { isa = XCConfigurationList; buildConfigurations = ( 01308DAD13491C3500453707 /* Debug */, 01308DAE13491C3500453707 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 01308DAF13491C3500453707 /* Build configuration list for PBXNativeTarget "ControlsDemo" */ = { isa = XCConfigurationList; buildConfigurations = ( 01308DB013491C3500453707 /* Debug */, 01308DB113491C3500453707 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 01308D8513491C3500453707 /* Project object */; } ================================================ FILE: Examples/Controls Demo/iCarouselControlsDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: Examples/Controls Demo/iCarouselControlsDemo.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings ================================================ IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded ================================================ FILE: Examples/Controls Demo/iCarouselExampleAppDelegate.h ================================================ // // iCarouselExampleAppDelegate.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import @class iCarouselExampleViewController; @interface iCarouselExampleAppDelegate : NSObject @property (nonatomic, strong) IBOutlet UIWindow *window; @property (nonatomic, strong) IBOutlet iCarouselExampleViewController *viewController; @end ================================================ FILE: Examples/Controls Demo/iCarouselExampleAppDelegate.m ================================================ // // iCarouselExampleAppDelegate.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleAppDelegate.h" #import "iCarouselExampleViewController.h" @implementation iCarouselExampleAppDelegate @synthesize window; @synthesize viewController; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [window addSubview:viewController.view]; [window makeKeyAndVisible]; return YES; } @end ================================================ FILE: Examples/Controls Demo/iCarouselExampleViewController.h ================================================ // // iCarouselExampleViewController.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import #import "iCarousel.h" @interface iCarouselExampleViewController : UIViewController @property (nonatomic, strong) IBOutlet iCarousel *carousel; @property (nonatomic, strong) IBOutlet UILabel *label; - (IBAction)pressedButton:(id)sender; - (IBAction)toggledSwitch:(id)sender; - (IBAction)changedSlider:(id)sender; @end ================================================ FILE: Examples/Controls Demo/iCarouselExampleViewController.m ================================================ // // iCarouselExampleViewController.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleViewController.h" @implementation iCarouselExampleViewController @synthesize carousel; @synthesize label; - (void)dealloc { carousel.delegate = nil; carousel.dataSource = nil; } #pragma mark - #pragma mark View lifecycle - (void)viewDidLoad { [super viewDidLoad]; //configure carousel carousel.type = iCarouselTypeCoverFlow2; } - (void)viewDidUnload { [super viewDidUnload]; self.carousel = nil; self.label = nil; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } #pragma mark - #pragma mark iCarousel methods - (NSInteger)numberOfItemsInCarousel:(iCarousel *)carousel { //generate 100 item views //normally we'd use a backing array //as shown in the basic iOS example //but for this example we haven't bothered return 100; } - (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view { if (!view) { //load new item view instance from nib //control events are bound to view controller in nib file //note that it is only safe to use the reusingView if we return the same nib for each //item view, if different items have different contents, ignore the reusingView value view = [[[NSBundle mainBundle] loadNibNamed:@"ItemView" owner:self options:nil] lastObject]; } return view; } #pragma mark - #pragma mark Control events - (IBAction)pressedButton:(id)sender { label.text = [NSString stringWithFormat:@"Button %i pressed", [carousel indexOfItemViewOrSubview:sender]]; } - (IBAction)toggledSwitch:(id)sender { label.text = [NSString stringWithFormat:@"Switch %i toggled", [carousel indexOfItemViewOrSubview:sender]]; } - (IBAction)changedSlider:(id)sender { label.text = [NSString stringWithFormat:@"Slider %i changed", [carousel indexOfItemViewOrSubview:sender]]; } @end ================================================ FILE: Examples/Controls Demo/iCarouselTest-Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleDisplayName ${PRODUCT_NAME} CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIconFile CFBundleIdentifier com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier} CFBundleInfoDictionaryVersion 6.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1.0 LSRequiresIPhoneOS NSMainNibFile MainWindow UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIStatusBarHidden ================================================ FILE: Examples/Controls Demo/iCarouselTest-Prefix.pch ================================================ // // Prefix header for all source files of the 'iCarouselExample' target in the 'iCarouselExample' project // #import #ifndef __IPHONE_3_0 #warning "This project uses features only available in iPhone SDK 3.0 and later." #endif #ifdef __OBJC__ #import #import #endif ================================================ FILE: Examples/Controls Demo/main.m ================================================ // // main.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import int main(int argc, char *argv[]) { @autoreleasepool { int retVal = UIApplicationMain(argc, argv, nil, nil); return retVal; } } ================================================ FILE: Examples/Downloads & Effects/Images.plist ================================================ http://charcoaldesign.co.uk/AsyncImageView/Forest/IMG_0351.JPG http://charcoaldesign.co.uk/AsyncImageView/Forest/IMG_0352.JPG http://charcoaldesign.co.uk/AsyncImageView/Forest/IMG_0355.JPG http://charcoaldesign.co.uk/AsyncImageView/Forest/IMG_0356.JPG http://charcoaldesign.co.uk/AsyncImageView/Forest/IMG_0357.JPG http://charcoaldesign.co.uk/AsyncImageView/Forest/IMG_0358.JPG http://charcoaldesign.co.uk/AsyncImageView/Forest/IMG_0361.JPG http://charcoaldesign.co.uk/AsyncImageView/Forest/IMG_0362.JPG http://charcoaldesign.co.uk/AsyncImageView/Lake/IMG_0150.jpg http://charcoaldesign.co.uk/AsyncImageView/Lake/IMG_0154.jpg http://charcoaldesign.co.uk/AsyncImageView/Lake/IMG_0163.jpg http://charcoaldesign.co.uk/AsyncImageView/Lake/IMG_0169.jpg http://charcoaldesign.co.uk/AsyncImageView/Lake/IMG_0170.jpg http://charcoaldesign.co.uk/AsyncImageView/Lake/IMG_0173.jpg http://charcoaldesign.co.uk/AsyncImageView/Lake/IMG_0174.jpg http://charcoaldesign.co.uk/AsyncImageView/Lake/IMG_0180.jpg http://charcoaldesign.co.uk/AsyncImageView/Lake/IMG_0181.jpg http://charcoaldesign.co.uk/AsyncImageView/Lake/IMG_0184.jpg http://charcoaldesign.co.uk/AsyncImageView/Lake/IMG_0197.jpg ================================================ FILE: Examples/Downloads & Effects/en.lproj/InfoPlist.strings ================================================ /* Localized versions of Info.plist keys */ ================================================ FILE: Examples/Downloads & Effects/en.lproj/MainWindow.xib ================================================ 1552 12E55 3084 1187.39 626.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin 2083 YES IBProxyObject IBUICustomObject IBUIViewController IBUIWindow YES com.apple.InterfaceBuilder.IBCocoaTouchPlugin PluginDependencyRecalculationVersion YES IBFilesOwner IBCocoaTouchFramework IBFirstResponder IBCocoaTouchFramework IBCocoaTouchFramework iCarouselExampleViewController 1 1 IBCocoaTouchFramework NO 292 {320, 480} 1 MSAxIDEAA NO NO IBCocoaTouchFramework YES YES delegate 4 viewController 11 window 14 rootViewController 16 YES 0 YES -1 File's Owner 3 iCarouselExample App Delegate -2 10 12 YES YES -1.CustomClassName -1.IBPluginDependency -2.CustomClassName -2.IBPluginDependency 10.CustomClassName 10.IBPluginDependency 12.IBPluginDependency 3.CustomClassName 3.IBPluginDependency YES UIApplication com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIResponder com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarouselExampleViewController com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarouselExampleAppDelegate com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES 16 YES iCarousel UIView YES YES dataSource delegate YES id id YES YES dataSource delegate YES dataSource id delegate id IBProjectSource ./Classes/iCarousel.h iCarouselExampleAppDelegate NSObject YES YES viewController window YES iCarouselExampleViewController UIWindow YES YES viewController window YES viewController iCarouselExampleViewController window UIWindow IBProjectSource ./Classes/iCarouselExampleAppDelegate.h iCarouselExampleViewController UIViewController carousel iCarousel carousel carousel iCarousel IBProjectSource ./Classes/iCarouselExampleViewController.h 0 IBCocoaTouchFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 YES 3 2083 ================================================ FILE: Examples/Downloads & Effects/en.lproj/iCarouselExampleViewController.xib ================================================ 1552 12E55 3084 1187.39 626.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin 2083 YES IBProxyObject IBUIImageView IBUIView YES com.apple.InterfaceBuilder.IBCocoaTouchPlugin PluginDependencyRecalculationVersion YES IBFilesOwner IBCocoaTouchFramework IBFirstResponder IBCocoaTouchFramework 274 YES 274 {320, 468} NO YES YES IBCocoaTouchFramework NSImage background.png 274 {320, 460} 3 MSAwAA 2 IBCocoaTouchFramework {{0, 20}, {320, 460}} 3 MC43NQA NO IBCocoaTouchFramework YES view 7 carousel 9 dataSource 10 delegate 11 YES 0 YES -1 File's Owner -2 6 YES 8 YES iCarousel 21 YES YES -1.CustomClassName -1.IBPluginDependency -2.CustomClassName -2.IBPluginDependency 21.IBPluginDependency 6.IBPluginDependency 8.CustomClassName 8.IBPluginDependency YES iCarouselExampleViewController com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIResponder com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarousel com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES 37 YES iCarousel UIView YES YES dataSource delegate YES id id YES YES dataSource delegate YES dataSource id delegate id IBProjectSource ./Classes/iCarousel.h iCarouselExampleViewController UIViewController carousel iCarousel carousel carousel iCarousel IBProjectSource ./Classes/iCarouselExampleViewController.h 0 IBCocoaTouchFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 YES 3 background.png {50, 468} 2083 ================================================ FILE: Examples/Downloads & Effects/iCarouselExample-Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleDisplayName ${PRODUCT_NAME} CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIconFile CFBundleIdentifier com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier} CFBundleInfoDictionaryVersion 6.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1.0 LSRequiresIPhoneOS NSMainNibFile MainWindow UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIStatusBarHidden ================================================ FILE: Examples/Downloads & Effects/iCarouselExample-Prefix.pch ================================================ // // Prefix header for all source files of the 'iCarouselExample' target in the 'iCarouselExample' project // #import #ifndef __IPHONE_3_0 #warning "This project uses features only available in iPhone SDK 3.0 and later." #endif #ifdef __OBJC__ #import #import #endif ================================================ FILE: Examples/Downloads & Effects/iCarouselExample.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 01308D9313491C3500453707 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9213491C3500453707 /* UIKit.framework */; }; 01308D9513491C3500453707 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9413491C3500453707 /* Foundation.framework */; }; 01308D9713491C3500453707 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9613491C3500453707 /* CoreGraphics.framework */; }; 01308DC013491F7200453707 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308DBF13491F7200453707 /* QuartzCore.framework */; }; 0148358813A36C2000E687AC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358313A36C2000E687AC /* main.m */; }; 0148359313A36C3700E687AC /* iCarouselExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */; }; 0148359413A36C3700E687AC /* iCarouselExampleAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */; }; 0148359513A36C3700E687AC /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0148358F13A36C3700E687AC /* MainWindow.xib */; }; 0148359613A36C3700E687AC /* iCarouselExampleViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */; }; 016334CD159BB378007DECD4 /* Images.plist in Resources */ = {isa = PBXBuildFile; fileRef = 016334CC159BB378007DECD4 /* Images.plist */; }; 018AE991179D849100FB7311 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 018AE990179D849100FB7311 /* Default-568h@2x.png */; }; B2BCBA86159C6DD8004942A1 /* FXImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = B2BCBA82159C6DD8004942A1 /* FXImageView.m */; }; B2BCBA87159C6DD8004942A1 /* UIImage+FX.m in Sources */ = {isa = PBXBuildFile; fileRef = B2BCBA84159C6DD8004942A1 /* UIImage+FX.m */; }; B2BCBA89159C6E57004942A1 /* placeholder.png in Resources */ = {isa = PBXBuildFile; fileRef = B2BCBA88159C6E57004942A1 /* placeholder.png */; }; B2E5E6C1146145C900EADB7A /* iCarousel.m in Sources */ = {isa = PBXBuildFile; fileRef = B2E5E6C0146145C900EADB7A /* iCarousel.m */; }; B2E5E72D1461544B00EADB7A /* background.png in Resources */ = {isa = PBXBuildFile; fileRef = B2E5E72B1461544B00EADB7A /* background.png */; }; B2E5E72E1461544B00EADB7A /* page.png in Resources */ = {isa = PBXBuildFile; fileRef = B2E5E72C1461544B00EADB7A /* page.png */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 01308D9213491C3500453707 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 01308D9413491C3500453707 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 01308D9613491C3500453707 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 01308DBF13491F7200453707 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 0148358313A36C2000E687AC /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = SOURCE_ROOT; }; 0148358413A36C2000E687AC /* iCarouselExample-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "iCarouselExample-Info.plist"; sourceTree = SOURCE_ROOT; }; 0148358513A36C2000E687AC /* iCarouselExample-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "iCarouselExample-Prefix.pch"; sourceTree = SOURCE_ROOT; }; 0148358713A36C2000E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = SOURCE_ROOT; }; 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleViewController.m; sourceTree = SOURCE_ROOT; }; 0148358C13A36C3700E687AC /* iCarouselExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleViewController.h; sourceTree = SOURCE_ROOT; }; 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleAppDelegate.m; sourceTree = SOURCE_ROOT; }; 0148358E13A36C3700E687AC /* iCarouselExampleAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleAppDelegate.h; sourceTree = SOURCE_ROOT; }; 0148359013A36C3700E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainWindow.xib; sourceTree = SOURCE_ROOT; }; 0148359213A36C3700E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/iCarouselExampleViewController.xib; sourceTree = SOURCE_ROOT; }; 016334CC159BB378007DECD4 /* Images.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Images.plist; sourceTree = SOURCE_ROOT; }; 018AE990179D849100FB7311 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = SOURCE_ROOT; }; 018BBCB413A375AF005CA505 /* iCarouselExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iCarouselExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; B2BCBA81159C6DD8004942A1 /* FXImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FXImageView.h; sourceTree = ""; }; B2BCBA82159C6DD8004942A1 /* FXImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FXImageView.m; sourceTree = ""; }; B2BCBA83159C6DD8004942A1 /* UIImage+FX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+FX.h"; sourceTree = ""; }; B2BCBA84159C6DD8004942A1 /* UIImage+FX.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+FX.m"; sourceTree = ""; }; B2BCBA88159C6E57004942A1 /* placeholder.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = placeholder.png; path = ../Resources/placeholder.png; sourceTree = SOURCE_ROOT; }; B2E5E6BF146145C900EADB7A /* iCarousel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarousel.h; sourceTree = ""; }; B2E5E6C0146145C900EADB7A /* iCarousel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarousel.m; sourceTree = ""; }; B2E5E72B1461544B00EADB7A /* background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = background.png; path = ../Resources/background.png; sourceTree = SOURCE_ROOT; }; B2E5E72C1461544B00EADB7A /* page.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = page.png; path = ../Resources/page.png; sourceTree = SOURCE_ROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 01308D8B13491C3500453707 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 01308DC013491F7200453707 /* QuartzCore.framework in Frameworks */, 01308D9313491C3500453707 /* UIKit.framework in Frameworks */, 01308D9513491C3500453707 /* Foundation.framework in Frameworks */, 01308D9713491C3500453707 /* CoreGraphics.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 01308D8313491C3500453707 = { isa = PBXGroup; children = ( B2E5E6BE146145C900EADB7A /* iCarousel */, B2BCBA80159C6DD8004942A1 /* FXImageView */, 01308D9813491C3500453707 /* iCarouselExample */, 01308D9113491C3500453707 /* Frameworks */, 01308D8F13491C3500453707 /* Products */, ); sourceTree = ""; }; 01308D8F13491C3500453707 /* Products */ = { isa = PBXGroup; children = ( 018BBCB413A375AF005CA505 /* iCarouselExample.app */, ); name = Products; sourceTree = ""; }; 01308D9113491C3500453707 /* Frameworks */ = { isa = PBXGroup; children = ( 01308DBF13491F7200453707 /* QuartzCore.framework */, 01308D9213491C3500453707 /* UIKit.framework */, 01308D9413491C3500453707 /* Foundation.framework */, 01308D9613491C3500453707 /* CoreGraphics.framework */, ); name = Frameworks; sourceTree = ""; }; 01308D9813491C3500453707 /* iCarouselExample */ = { isa = PBXGroup; children = ( 016334CC159BB378007DECD4 /* Images.plist */, 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */, 0148358C13A36C3700E687AC /* iCarouselExampleViewController.h */, 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */, 0148358E13A36C3700E687AC /* iCarouselExampleAppDelegate.h */, 0148358F13A36C3700E687AC /* MainWindow.xib */, 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */, B2E5E72A1461543E00EADB7A /* Resources */, 01308D9913491C3500453707 /* Supporting Files */, ); path = iCarouselExample; sourceTree = ""; }; 01308D9913491C3500453707 /* Supporting Files */ = { isa = PBXGroup; children = ( 018AE990179D849100FB7311 /* Default-568h@2x.png */, 0148358313A36C2000E687AC /* main.m */, 0148358413A36C2000E687AC /* iCarouselExample-Info.plist */, 0148358513A36C2000E687AC /* iCarouselExample-Prefix.pch */, 0148358613A36C2000E687AC /* InfoPlist.strings */, ); name = "Supporting Files"; sourceTree = ""; }; B2BCBA80159C6DD8004942A1 /* FXImageView */ = { isa = PBXGroup; children = ( B2BCBA81159C6DD8004942A1 /* FXImageView.h */, B2BCBA82159C6DD8004942A1 /* FXImageView.m */, B2BCBA83159C6DD8004942A1 /* UIImage+FX.h */, B2BCBA84159C6DD8004942A1 /* UIImage+FX.m */, ); name = FXImageView; path = ../Libraries/FXImageView; sourceTree = ""; }; B2E5E6BE146145C900EADB7A /* iCarousel */ = { isa = PBXGroup; children = ( B2E5E6BF146145C900EADB7A /* iCarousel.h */, B2E5E6C0146145C900EADB7A /* iCarousel.m */, ); name = iCarousel; path = ../../iCarousel; sourceTree = ""; }; B2E5E72A1461543E00EADB7A /* Resources */ = { isa = PBXGroup; children = ( B2BCBA88159C6E57004942A1 /* placeholder.png */, B2E5E72B1461544B00EADB7A /* background.png */, B2E5E72C1461544B00EADB7A /* page.png */, ); name = Resources; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 01308D8D13491C3500453707 /* iCarouselExample */ = { isa = PBXNativeTarget; buildConfigurationList = 01308DAF13491C3500453707 /* Build configuration list for PBXNativeTarget "iCarouselExample" */; buildPhases = ( 01308D8A13491C3500453707 /* Sources */, 01308D8B13491C3500453707 /* Frameworks */, 01308D8C13491C3500453707 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = iCarouselExample; productName = iCarouselExample; productReference = 018BBCB413A375AF005CA505 /* iCarouselExample.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 01308D8513491C3500453707 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0600; }; buildConfigurationList = 01308D8813491C3500453707 /* Build configuration list for PBXProject "iCarouselExample" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); mainGroup = 01308D8313491C3500453707; productRefGroup = 01308D8F13491C3500453707 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 01308D8D13491C3500453707 /* iCarouselExample */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 01308D8C13491C3500453707 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 0148359513A36C3700E687AC /* MainWindow.xib in Resources */, 0148359613A36C3700E687AC /* iCarouselExampleViewController.xib in Resources */, B2E5E72D1461544B00EADB7A /* background.png in Resources */, B2E5E72E1461544B00EADB7A /* page.png in Resources */, 016334CD159BB378007DECD4 /* Images.plist in Resources */, B2BCBA89159C6E57004942A1 /* placeholder.png in Resources */, 018AE991179D849100FB7311 /* Default-568h@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 01308D8A13491C3500453707 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 0148358813A36C2000E687AC /* main.m in Sources */, 0148359313A36C3700E687AC /* iCarouselExampleViewController.m in Sources */, 0148359413A36C3700E687AC /* iCarouselExampleAppDelegate.m in Sources */, B2E5E6C1146145C900EADB7A /* iCarousel.m in Sources */, B2BCBA86159C6DD8004942A1 /* FXImageView.m in Sources */, B2BCBA87159C6DD8004942A1 /* UIImage+FX.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 0148358613A36C2000E687AC /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( 0148358713A36C2000E687AC /* en */, ); name = InfoPlist.strings; sourceTree = ""; }; 0148358F13A36C3700E687AC /* MainWindow.xib */ = { isa = PBXVariantGroup; children = ( 0148359013A36C3700E687AC /* en */, ); name = MainWindow.xib; sourceTree = ""; }; 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */ = { isa = PBXVariantGroup; children = ( 0148359213A36C3700E687AC /* en */, ); name = iCarouselExampleViewController.xib; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 01308DAD13491C3500453707 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = DEBUG; GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 4.2; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; }; name = Debug; }; 01308DAE13491C3500453707 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 4.2; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; SDKROOT = iphoneos; }; name = Release; }; 01308DB013491C3500453707 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselExample-Prefix.pch"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = "iCarouselExample-Info.plist"; PRODUCT_NAME = iCarouselExample; TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = app; }; name = Debug; }; 01308DB113491C3500453707 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselExample-Prefix.pch"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = "iCarouselExample-Info.plist"; PRODUCT_NAME = iCarouselExample; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; WRAPPER_EXTENSION = app; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 01308D8813491C3500453707 /* Build configuration list for PBXProject "iCarouselExample" */ = { isa = XCConfigurationList; buildConfigurations = ( 01308DAD13491C3500453707 /* Debug */, 01308DAE13491C3500453707 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 01308DAF13491C3500453707 /* Build configuration list for PBXNativeTarget "iCarouselExample" */ = { isa = XCConfigurationList; buildConfigurations = ( 01308DB013491C3500453707 /* Debug */, 01308DB113491C3500453707 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 01308D8513491C3500453707 /* Project object */; } ================================================ FILE: Examples/Downloads & Effects/iCarouselExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: Examples/Downloads & Effects/iCarouselExampleAppDelegate.h ================================================ // // iCarouselExampleAppDelegate.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import @class iCarouselExampleViewController; @interface iCarouselExampleAppDelegate : NSObject @property (strong, nonatomic) IBOutlet UIWindow *window; @property (strong, nonatomic) IBOutlet iCarouselExampleViewController *viewController; @end ================================================ FILE: Examples/Downloads & Effects/iCarouselExampleAppDelegate.m ================================================ // // iCarouselExampleAppDelegate.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleAppDelegate.h" #import "iCarouselExampleViewController.h" @implementation iCarouselExampleAppDelegate @synthesize window; @synthesize viewController; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { return YES; } @end ================================================ FILE: Examples/Downloads & Effects/iCarouselExampleViewController.h ================================================ // // iCarouselExampleViewController.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import #import "iCarousel.h" @interface iCarouselExampleViewController : UIViewController @property (strong, nonatomic) IBOutlet iCarousel *carousel; @end ================================================ FILE: Examples/Downloads & Effects/iCarouselExampleViewController.m ================================================ // // iCarouselExampleViewController.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleViewController.h" #import "FXImageView.h" @interface iCarouselExampleViewController () @property (strong, nonatomic) NSMutableArray *items; @end @implementation iCarouselExampleViewController @synthesize carousel; @synthesize items; - (void)awakeFromNib { //set up data //your carousel should always be driven by an array of //data of some kind - don't store data in your item views //or the recycling mechanism will destroy your data once //your item views move off-screen //get image URLs NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"Images" ofType:@"plist"]; NSArray *imagePaths = [NSArray arrayWithContentsOfFile:plistPath]; //remote image URLs NSMutableArray *URLs = [NSMutableArray array]; for (NSString *path in imagePaths) { NSURL *URL = [NSURL URLWithString:path]; if (URL) { [URLs addObject:URL]; } else { NSLog(@"'%@' is not a valid URL", path); } } self.items = URLs; [self.carousel reloadData]; } - (void)dealloc { //it's a good idea to set these to nil here to avoid //sending messages to a deallocated viewcontroller carousel.delegate = nil; carousel.dataSource = nil; } #pragma mark - #pragma mark View lifecycle - (void)viewDidLoad { [super viewDidLoad]; //configure carousel carousel.type = iCarouselTypeCoverFlow2; } - (void)viewDidUnload { [super viewDidUnload]; //free up memory by releasing subviews self.carousel = nil; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } #pragma mark - #pragma mark iCarousel methods - (NSInteger)numberOfItemsInCarousel:(iCarousel *)carousel { //return the total number of items in the carousel return [items count]; } - (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view { //create new view if no view is available for recycling if (view == nil) { FXImageView *imageView = [[FXImageView alloc] initWithFrame:CGRectMake(0, 0, 200.0f, 200.0f)]; imageView.contentMode = UIViewContentModeScaleAspectFit; imageView.asynchronous = YES; imageView.reflectionScale = 0.5f; imageView.reflectionAlpha = 0.25f; imageView.reflectionGap = 10.0f; imageView.shadowOffset = CGSizeMake(0.0f, 2.0f); imageView.shadowBlur = 5.0f; view = imageView; } //show placeholder ((FXImageView *)view).processedImage = [UIImage imageNamed:@"placeholder.png"]; //set image with URL. FXImageView will then download and process the image [(FXImageView *)view setImageWithContentsOfURL:[items objectAtIndex:index]]; return view; } @end ================================================ FILE: Examples/Downloads & Effects/main.m ================================================ // // main.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import int main(int argc, char *argv[]) { @autoreleasepool { int retVal = UIApplicationMain(argc, argv, nil, nil); return retVal; } } ================================================ FILE: Examples/Dynamic Downloads/Images.plist ================================================ http://charcoaldesign.co.uk/AsyncImageView/Forest/IMG_0351.JPG http://charcoaldesign.co.uk/AsyncImageView/Forest/IMG_0352.JPG http://charcoaldesign.co.uk/AsyncImageView/Forest/IMG_0355.JPG http://charcoaldesign.co.uk/AsyncImageView/Forest/IMG_0356.JPG http://charcoaldesign.co.uk/AsyncImageView/Forest/IMG_0357.JPG http://charcoaldesign.co.uk/AsyncImageView/Forest/IMG_0358.JPG http://charcoaldesign.co.uk/AsyncImageView/Forest/IMG_0361.JPG http://charcoaldesign.co.uk/AsyncImageView/Forest/IMG_0362.JPG http://charcoaldesign.co.uk/AsyncImageView/Lake/IMG_0150.jpg http://charcoaldesign.co.uk/AsyncImageView/Lake/IMG_0154.jpg http://charcoaldesign.co.uk/AsyncImageView/Lake/IMG_0163.jpg http://charcoaldesign.co.uk/AsyncImageView/Lake/IMG_0169.jpg http://charcoaldesign.co.uk/AsyncImageView/Lake/IMG_0170.jpg http://charcoaldesign.co.uk/AsyncImageView/Lake/IMG_0173.jpg http://charcoaldesign.co.uk/AsyncImageView/Lake/IMG_0174.jpg http://charcoaldesign.co.uk/AsyncImageView/Lake/IMG_0180.jpg http://charcoaldesign.co.uk/AsyncImageView/Lake/IMG_0181.jpg http://charcoaldesign.co.uk/AsyncImageView/Lake/IMG_0184.jpg http://charcoaldesign.co.uk/AsyncImageView/Lake/IMG_0197.jpg ================================================ FILE: Examples/Dynamic Downloads/en.lproj/InfoPlist.strings ================================================ /* Localized versions of Info.plist keys */ ================================================ FILE: Examples/Dynamic Downloads/en.lproj/MainWindow.xib ================================================ 1024 10D571 786 1038.29 460.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin 112 YES YES com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES YES YES IBFilesOwner IBCocoaTouchFramework IBFirstResponder IBCocoaTouchFramework IBCocoaTouchFramework iCarouselExampleViewController 1 IBCocoaTouchFramework NO 292 {320, 480} 1 MSAxIDEAA NO NO IBCocoaTouchFramework YES YES delegate 4 viewController 11 window 14 YES 0 -1 File's Owner 3 iCarouselExample App Delegate -2 10 12 YES YES -1.CustomClassName -2.CustomClassName 10.CustomClassName 10.IBEditorWindowLastContentRect 10.IBPluginDependency 12.IBEditorWindowLastContentRect 12.IBPluginDependency 3.CustomClassName 3.IBPluginDependency YES UIApplication UIResponder iCarouselExampleViewController {{234, 376}, {320, 480}} com.apple.InterfaceBuilder.IBCocoaTouchPlugin {{525, 346}, {320, 480}} com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarouselExampleAppDelegate com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES YES YES 15 YES UIWindow UIView IBUserSource iCarouselExampleAppDelegate NSObject YES YES viewController window YES iCarouselExampleViewController UIWindow YES YES viewController window YES viewController iCarouselExampleViewController window UIWindow IBProjectSource iCarouselExampleAppDelegate.h iCarouselExampleAppDelegate NSObject IBUserSource iCarouselExampleViewController UIViewController IBProjectSource iCarouselExampleViewController.h YES NSObject IBFrameworkSource Foundation.framework/Headers/NSError.h NSObject IBFrameworkSource Foundation.framework/Headers/NSFileManager.h NSObject IBFrameworkSource Foundation.framework/Headers/NSKeyValueCoding.h NSObject IBFrameworkSource Foundation.framework/Headers/NSKeyValueObserving.h NSObject IBFrameworkSource Foundation.framework/Headers/NSKeyedArchiver.h NSObject IBFrameworkSource Foundation.framework/Headers/NSObject.h NSObject IBFrameworkSource Foundation.framework/Headers/NSRunLoop.h NSObject IBFrameworkSource Foundation.framework/Headers/NSThread.h NSObject IBFrameworkSource Foundation.framework/Headers/NSURL.h NSObject IBFrameworkSource Foundation.framework/Headers/NSURLConnection.h NSObject IBFrameworkSource UIKit.framework/Headers/UIAccessibility.h NSObject IBFrameworkSource UIKit.framework/Headers/UINibLoading.h NSObject IBFrameworkSource UIKit.framework/Headers/UIResponder.h UIApplication UIResponder IBFrameworkSource UIKit.framework/Headers/UIApplication.h UIResponder NSObject UISearchBar UIView IBFrameworkSource UIKit.framework/Headers/UISearchBar.h UISearchDisplayController NSObject IBFrameworkSource UIKit.framework/Headers/UISearchDisplayController.h UIView IBFrameworkSource UIKit.framework/Headers/UITextField.h UIView UIResponder IBFrameworkSource UIKit.framework/Headers/UIView.h UIViewController IBFrameworkSource UIKit.framework/Headers/UINavigationController.h UIViewController IBFrameworkSource UIKit.framework/Headers/UIPopoverController.h UIViewController IBFrameworkSource UIKit.framework/Headers/UISplitViewController.h UIViewController IBFrameworkSource UIKit.framework/Headers/UITabBarController.h UIViewController UIResponder IBFrameworkSource UIKit.framework/Headers/UIViewController.h UIWindow UIView IBFrameworkSource UIKit.framework/Headers/UIWindow.h 0 IBCocoaTouchFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 YES iCarouselExample.xcodeproj 3 112 ================================================ FILE: Examples/Dynamic Downloads/en.lproj/iCarouselExampleViewController.xib ================================================ 1280 11D50 2182 1138.32 568.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin 1181 YES IBProxyObject IBUIView IBUIImageView YES com.apple.InterfaceBuilder.IBCocoaTouchPlugin PluginDependencyRecalculationVersion YES IBFilesOwner IBCocoaTouchFramework IBFirstResponder IBCocoaTouchFramework 274 YES 274 {320, 468} NO YES YES IBCocoaTouchFramework NSImage background.png 274 {320, 460} 3 MSAwAA 2 IBCocoaTouchFramework {{0, 20}, {320, 460}} 3 MC43NQA NO IBCocoaTouchFramework YES view 7 carousel 9 dataSource 10 delegate 11 YES 0 YES -1 File's Owner -2 6 YES 8 YES iCarousel 21 YES YES -1.CustomClassName -1.IBPluginDependency -2.CustomClassName -2.IBPluginDependency 21.IBPluginDependency 6.IBPluginDependency 8.CustomClassName 8.IBPluginDependency YES iCarouselExampleViewController com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIResponder com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarousel com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES 37 YES iCarousel UIView YES YES dataSource delegate YES id id YES YES dataSource delegate YES dataSource id delegate id IBProjectSource ./Classes/iCarousel.h iCarouselExampleViewController UIViewController YES YES insertItem removeItem switchCarouselType toggleOrientation toggleWrap YES id id id id id YES YES insertItem removeItem switchCarouselType toggleOrientation toggleWrap YES insertItem id removeItem id switchCarouselType id toggleOrientation id toggleWrap id YES YES carousel navItem orientationBarItem wrapBarItem YES iCarousel UINavigationItem UIBarItem UIBarItem YES YES carousel navItem orientationBarItem wrapBarItem YES carousel iCarousel navItem UINavigationItem orientationBarItem UIBarItem wrapBarItem UIBarItem IBProjectSource ./Classes/iCarouselExampleViewController.h 0 IBCocoaTouchFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 YES 3 background.png {50, 468} 1181 ================================================ FILE: Examples/Dynamic Downloads/iCarouselExample-Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleDisplayName ${PRODUCT_NAME} CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIconFile CFBundleIdentifier com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier} CFBundleInfoDictionaryVersion 6.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1.0 LSRequiresIPhoneOS NSMainNibFile MainWindow UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIStatusBarHidden ================================================ FILE: Examples/Dynamic Downloads/iCarouselExample-Prefix.pch ================================================ // // Prefix header for all source files of the 'iCarouselExample' target in the 'iCarouselExample' project // #import #ifndef __IPHONE_3_0 #warning "This project uses features only available in iPhone SDK 3.0 and later." #endif #ifdef __OBJC__ #import #import #endif ================================================ FILE: Examples/Dynamic Downloads/iCarouselExample.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 01308D9313491C3500453707 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9213491C3500453707 /* UIKit.framework */; }; 01308D9513491C3500453707 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9413491C3500453707 /* Foundation.framework */; }; 01308D9713491C3500453707 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9613491C3500453707 /* CoreGraphics.framework */; }; 01308DC013491F7200453707 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308DBF13491F7200453707 /* QuartzCore.framework */; }; 0148358813A36C2000E687AC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358313A36C2000E687AC /* main.m */; }; 0148359313A36C3700E687AC /* iCarouselExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */; }; 0148359413A36C3700E687AC /* iCarouselExampleAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */; }; 0148359513A36C3700E687AC /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0148358F13A36C3700E687AC /* MainWindow.xib */; }; 0148359613A36C3700E687AC /* iCarouselExampleViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */; }; 016334CD159BB378007DECD4 /* Images.plist in Resources */ = {isa = PBXBuildFile; fileRef = 016334CC159BB378007DECD4 /* Images.plist */; }; 018AE993179D85FF00FB7311 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 018AE992179D85FF00FB7311 /* Default-568h@2x.png */; }; B2BCBA92159C8D81004942A1 /* AsyncImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = B2BCBA91159C8D81004942A1 /* AsyncImageView.m */; }; B2E5E6C1146145C900EADB7A /* iCarousel.m in Sources */ = {isa = PBXBuildFile; fileRef = B2E5E6C0146145C900EADB7A /* iCarousel.m */; }; B2E5E72D1461544B00EADB7A /* background.png in Resources */ = {isa = PBXBuildFile; fileRef = B2E5E72B1461544B00EADB7A /* background.png */; }; B2E5E72E1461544B00EADB7A /* page.png in Resources */ = {isa = PBXBuildFile; fileRef = B2E5E72C1461544B00EADB7A /* page.png */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 01308D9213491C3500453707 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 01308D9413491C3500453707 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 01308D9613491C3500453707 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 01308DBF13491F7200453707 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 0148358313A36C2000E687AC /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = SOURCE_ROOT; }; 0148358413A36C2000E687AC /* iCarouselExample-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "iCarouselExample-Info.plist"; sourceTree = SOURCE_ROOT; }; 0148358513A36C2000E687AC /* iCarouselExample-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "iCarouselExample-Prefix.pch"; sourceTree = SOURCE_ROOT; }; 0148358713A36C2000E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = SOURCE_ROOT; }; 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleViewController.m; sourceTree = SOURCE_ROOT; }; 0148358C13A36C3700E687AC /* iCarouselExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleViewController.h; sourceTree = SOURCE_ROOT; }; 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleAppDelegate.m; sourceTree = SOURCE_ROOT; }; 0148358E13A36C3700E687AC /* iCarouselExampleAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleAppDelegate.h; sourceTree = SOURCE_ROOT; }; 0148359013A36C3700E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainWindow.xib; sourceTree = SOURCE_ROOT; }; 0148359213A36C3700E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/iCarouselExampleViewController.xib; sourceTree = SOURCE_ROOT; }; 016334CC159BB378007DECD4 /* Images.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Images.plist; sourceTree = SOURCE_ROOT; }; 018AE992179D85FF00FB7311 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = SOURCE_ROOT; }; 018BBCB413A375AF005CA505 /* iCarouselExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iCarouselExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; B2BCBA90159C8D81004942A1 /* AsyncImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AsyncImageView.h; sourceTree = ""; }; B2BCBA91159C8D81004942A1 /* AsyncImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AsyncImageView.m; sourceTree = ""; }; B2E5E6BF146145C900EADB7A /* iCarousel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarousel.h; sourceTree = ""; }; B2E5E6C0146145C900EADB7A /* iCarousel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarousel.m; sourceTree = ""; }; B2E5E72B1461544B00EADB7A /* background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = background.png; path = ../Resources/background.png; sourceTree = SOURCE_ROOT; }; B2E5E72C1461544B00EADB7A /* page.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = page.png; path = ../Resources/page.png; sourceTree = SOURCE_ROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 01308D8B13491C3500453707 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 01308DC013491F7200453707 /* QuartzCore.framework in Frameworks */, 01308D9313491C3500453707 /* UIKit.framework in Frameworks */, 01308D9513491C3500453707 /* Foundation.framework in Frameworks */, 01308D9713491C3500453707 /* CoreGraphics.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 01308D8313491C3500453707 = { isa = PBXGroup; children = ( B2E5E6BE146145C900EADB7A /* iCarousel */, B2BCBA8F159C8D81004942A1 /* AsyncImageView */, 01308D9813491C3500453707 /* iCarouselExample */, 01308D9113491C3500453707 /* Frameworks */, 01308D8F13491C3500453707 /* Products */, ); sourceTree = ""; }; 01308D8F13491C3500453707 /* Products */ = { isa = PBXGroup; children = ( 018BBCB413A375AF005CA505 /* iCarouselExample.app */, ); name = Products; sourceTree = ""; }; 01308D9113491C3500453707 /* Frameworks */ = { isa = PBXGroup; children = ( 01308DBF13491F7200453707 /* QuartzCore.framework */, 01308D9213491C3500453707 /* UIKit.framework */, 01308D9413491C3500453707 /* Foundation.framework */, 01308D9613491C3500453707 /* CoreGraphics.framework */, ); name = Frameworks; sourceTree = ""; }; 01308D9813491C3500453707 /* iCarouselExample */ = { isa = PBXGroup; children = ( 016334CC159BB378007DECD4 /* Images.plist */, 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */, 0148358C13A36C3700E687AC /* iCarouselExampleViewController.h */, 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */, 0148358E13A36C3700E687AC /* iCarouselExampleAppDelegate.h */, 0148358F13A36C3700E687AC /* MainWindow.xib */, 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */, B2E5E72A1461543E00EADB7A /* Resources */, 01308D9913491C3500453707 /* Supporting Files */, ); path = iCarouselExample; sourceTree = ""; }; 01308D9913491C3500453707 /* Supporting Files */ = { isa = PBXGroup; children = ( 018AE992179D85FF00FB7311 /* Default-568h@2x.png */, 0148358313A36C2000E687AC /* main.m */, 0148358413A36C2000E687AC /* iCarouselExample-Info.plist */, 0148358513A36C2000E687AC /* iCarouselExample-Prefix.pch */, 0148358613A36C2000E687AC /* InfoPlist.strings */, ); name = "Supporting Files"; sourceTree = ""; }; B2BCBA8F159C8D81004942A1 /* AsyncImageView */ = { isa = PBXGroup; children = ( B2BCBA90159C8D81004942A1 /* AsyncImageView.h */, B2BCBA91159C8D81004942A1 /* AsyncImageView.m */, ); name = AsyncImageView; path = ../Libraries/AsyncImageView; sourceTree = ""; }; B2E5E6BE146145C900EADB7A /* iCarousel */ = { isa = PBXGroup; children = ( B2E5E6BF146145C900EADB7A /* iCarousel.h */, B2E5E6C0146145C900EADB7A /* iCarousel.m */, ); name = iCarousel; path = ../../iCarousel; sourceTree = ""; }; B2E5E72A1461543E00EADB7A /* Resources */ = { isa = PBXGroup; children = ( B2E5E72B1461544B00EADB7A /* background.png */, B2E5E72C1461544B00EADB7A /* page.png */, ); name = Resources; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 01308D8D13491C3500453707 /* iCarouselExample */ = { isa = PBXNativeTarget; buildConfigurationList = 01308DAF13491C3500453707 /* Build configuration list for PBXNativeTarget "iCarouselExample" */; buildPhases = ( 01308D8A13491C3500453707 /* Sources */, 01308D8B13491C3500453707 /* Frameworks */, 01308D8C13491C3500453707 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = iCarouselExample; productName = iCarouselExample; productReference = 018BBCB413A375AF005CA505 /* iCarouselExample.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 01308D8513491C3500453707 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0600; }; buildConfigurationList = 01308D8813491C3500453707 /* Build configuration list for PBXProject "iCarouselExample" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); mainGroup = 01308D8313491C3500453707; productRefGroup = 01308D8F13491C3500453707 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 01308D8D13491C3500453707 /* iCarouselExample */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 01308D8C13491C3500453707 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 0148359513A36C3700E687AC /* MainWindow.xib in Resources */, 0148359613A36C3700E687AC /* iCarouselExampleViewController.xib in Resources */, B2E5E72D1461544B00EADB7A /* background.png in Resources */, B2E5E72E1461544B00EADB7A /* page.png in Resources */, 016334CD159BB378007DECD4 /* Images.plist in Resources */, 018AE993179D85FF00FB7311 /* Default-568h@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 01308D8A13491C3500453707 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 0148358813A36C2000E687AC /* main.m in Sources */, 0148359313A36C3700E687AC /* iCarouselExampleViewController.m in Sources */, 0148359413A36C3700E687AC /* iCarouselExampleAppDelegate.m in Sources */, B2E5E6C1146145C900EADB7A /* iCarousel.m in Sources */, B2BCBA92159C8D81004942A1 /* AsyncImageView.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 0148358613A36C2000E687AC /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( 0148358713A36C2000E687AC /* en */, ); name = InfoPlist.strings; sourceTree = ""; }; 0148358F13A36C3700E687AC /* MainWindow.xib */ = { isa = PBXVariantGroup; children = ( 0148359013A36C3700E687AC /* en */, ); name = MainWindow.xib; sourceTree = ""; }; 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */ = { isa = PBXVariantGroup; children = ( 0148359213A36C3700E687AC /* en */, ); name = iCarouselExampleViewController.xib; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 01308DAD13491C3500453707 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = DEBUG; GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 4.2; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; }; name = Debug; }; 01308DAE13491C3500453707 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 4.2; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; SDKROOT = iphoneos; }; name = Release; }; 01308DB013491C3500453707 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselExample-Prefix.pch"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = "iCarouselExample-Info.plist"; PRODUCT_NAME = iCarouselExample; TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = app; }; name = Debug; }; 01308DB113491C3500453707 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselExample-Prefix.pch"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = "iCarouselExample-Info.plist"; PRODUCT_NAME = iCarouselExample; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; WRAPPER_EXTENSION = app; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 01308D8813491C3500453707 /* Build configuration list for PBXProject "iCarouselExample" */ = { isa = XCConfigurationList; buildConfigurations = ( 01308DAD13491C3500453707 /* Debug */, 01308DAE13491C3500453707 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 01308DAF13491C3500453707 /* Build configuration list for PBXNativeTarget "iCarouselExample" */ = { isa = XCConfigurationList; buildConfigurations = ( 01308DB013491C3500453707 /* Debug */, 01308DB113491C3500453707 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 01308D8513491C3500453707 /* Project object */; } ================================================ FILE: Examples/Dynamic Downloads/iCarouselExampleAppDelegate.h ================================================ // // iCarouselExampleAppDelegate.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import @class iCarouselExampleViewController; @interface iCarouselExampleAppDelegate : NSObject @property (nonatomic, strong) IBOutlet UIWindow *window; @property (nonatomic, strong) IBOutlet iCarouselExampleViewController *viewController; @end ================================================ FILE: Examples/Dynamic Downloads/iCarouselExampleAppDelegate.m ================================================ // // iCarouselExampleAppDelegate.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleAppDelegate.h" #import "iCarouselExampleViewController.h" @implementation iCarouselExampleAppDelegate @synthesize window; @synthesize viewController; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [window addSubview:viewController.view]; [window makeKeyAndVisible]; return YES; } @end ================================================ FILE: Examples/Dynamic Downloads/iCarouselExampleViewController.h ================================================ // // iCarouselExampleViewController.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import #import "iCarousel.h" @interface iCarouselExampleViewController : UIViewController @property (nonatomic, strong) IBOutlet iCarousel *carousel; @end ================================================ FILE: Examples/Dynamic Downloads/iCarouselExampleViewController.m ================================================ // // iCarouselExampleViewController.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleViewController.h" #import "AsyncImageView.h" @interface iCarouselExampleViewController () @property (nonatomic, strong) NSMutableArray *items; @end @implementation iCarouselExampleViewController @synthesize carousel; @synthesize items; - (void)awakeFromNib { //set up data //your carousel should always be driven by an array of //data of some kind - don't store data in your item views //or the recycling mechanism will destroy your data once //your item views move off-screen //get image URLs NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"Images" ofType:@"plist"]; NSArray *imagePaths = [NSArray arrayWithContentsOfFile:plistPath]; //remote image URLs NSMutableArray *URLs = [NSMutableArray array]; for (NSString *path in imagePaths) { NSURL *URL = [NSURL URLWithString:path]; if (URL) { [URLs addObject:URL]; } else { NSLog(@"'%@' is not a valid URL", path); } } self.items = URLs; } - (void)dealloc { //it's a good idea to set these to nil here to avoid //sending messages to a deallocated viewcontroller carousel.delegate = nil; carousel.dataSource = nil; } #pragma mark - #pragma mark View lifecycle - (void)viewDidLoad { [super viewDidLoad]; //configure carousel carousel.type = iCarouselTypeCoverFlow2; } - (void)viewDidUnload { [super viewDidUnload]; //free up memory by releasing subviews self.carousel = nil; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } #pragma mark - #pragma mark iCarousel methods - (NSInteger)numberOfItemsInCarousel:(iCarousel *)carousel { //return the total number of items in the carousel return [items count]; } - (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view { //create new view if no view is available for recycling if (view == nil) { view = [[AsyncImageView alloc] initWithFrame:CGRectMake(0, 0, 200.0f, 200.0f)]; view.contentMode = UIViewContentModeScaleAspectFit; } //cancel any previously loading images for this view [[AsyncImageLoader sharedLoader] cancelLoadingImagesForTarget:view]; //set image URL. AsyncImageView class will then dynamically load the image ((AsyncImageView *)view).imageURL = [items objectAtIndex:index]; return view; } @end ================================================ FILE: Examples/Dynamic Downloads/main.m ================================================ // // main.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import int main(int argc, char *argv[]) { @autoreleasepool { int retVal = UIApplicationMain(argc, argv, nil, nil); return retVal; } } ================================================ FILE: Examples/Dynamic Image Effects/iCarouselExample/AppDelegate.h ================================================ // // AppDelegate.h // ImageFXViewDemo // // Created by Nick Lockwood on 31/10/2011. // Copyright (c) 2011 __MyCompanyName__. All rights reserved. // #import @class ViewController; @interface AppDelegate : UIResponder @property (strong, nonatomic) UIWindow *window; @property (strong, nonatomic) ViewController *viewController; @end ================================================ FILE: Examples/Dynamic Image Effects/iCarouselExample/AppDelegate.m ================================================ // // AppDelegate.m // ImageFXViewDemo // // Created by Nick Lockwood on 31/10/2011. // Copyright (c) 2011 __MyCompanyName__. All rights reserved. // #import "AppDelegate.h" #import "ViewController.h" @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.viewController = [[ViewController alloc] init]; self.window.rootViewController = self.viewController; [self.window makeKeyAndVisible]; return YES; } @end ================================================ FILE: Examples/Dynamic Image Effects/iCarouselExample/ViewController.h ================================================ // // ViewController.h // ImageFXViewDemo // // Created by Nick Lockwood on 31/10/2011. // Copyright (c) 2011 __MyCompanyName__. All rights reserved. // #import #import "FXImageView.h" #import "iCarousel.h" @interface ViewController : UIViewController @property (nonatomic, strong) IBOutlet iCarousel *carousel; @end ================================================ FILE: Examples/Dynamic Image Effects/iCarouselExample/ViewController.m ================================================ // // ViewController.m // ImageFXViewDemo // // Created by Nick Lockwood on 31/10/2011. // Copyright (c) 2011 __MyCompanyName__. All rights reserved. // #import "ViewController.h" @interface ViewController () @property (nonatomic, strong) NSMutableArray *images; @end @implementation ViewController @synthesize carousel = _carousel; @synthesize images = _images; - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { //get image paths NSArray *imagePaths = [[NSBundle mainBundle] pathsForResourcesOfType:@"jpg" inDirectory:@"Lake"]; //preload images (although FXImageView can actually do this for us on the fly) _images = [[NSMutableArray alloc] init]; for (NSString *path in imagePaths) { [_images addObject:[UIImage imageWithContentsOfFile:path]]; } } return self; } - (void)viewDidLoad { [super viewDidLoad]; //configure carousel _carousel.type = iCarouselTypeCoverFlow2; } - (NSInteger)numberOfItemsInCarousel:(iCarousel *)carousel { return [_images count]; } - (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view { //create new view if no view is available for recycling if (view == nil) { FXImageView *imageView = [[FXImageView alloc] initWithFrame:CGRectMake(0, 0, 200.0f, 200.0f)]; imageView.contentMode = UIViewContentModeScaleAspectFit; imageView.asynchronous = YES; imageView.reflectionScale = 0.5f; imageView.reflectionAlpha = 0.25f; imageView.reflectionGap = 10.0f; imageView.shadowOffset = CGSizeMake(0.0f, 2.0f); imageView.shadowBlur = 5.0f; imageView.cornerRadius = 10.0f; view = imageView; } //show placeholder ((FXImageView *)view).processedImage = [UIImage imageNamed:@"placeholder.png"]; //set image ((FXImageView *)view).image = _images[index]; return view; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); } @end ================================================ FILE: Examples/Dynamic Image Effects/iCarouselExample/en.lproj/InfoPlist.strings ================================================ /* Localized versions of Info.plist keys */ ================================================ FILE: Examples/Dynamic Image Effects/iCarouselExample/en.lproj/ViewController.xib ================================================ 1280 13E28 6185.11 1265.21 698.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin 6190.4 IBProxyObject IBUIImageView IBUIView com.apple.InterfaceBuilder.IBCocoaTouchPlugin PluginDependencyRecalculationVersion IBFilesOwner IBCocoaTouchFramework IBFirstResponder IBCocoaTouchFramework 274 274 {320, 480} NO YES YES IBCocoaTouchFramework NSImage background.png 274 {320, 480} _NS:9 3 MCAwAA IBCocoaTouchFramework {320, 480} 3 MC43NQA 2 NO IBUIScreenMetrics IBCocoaTouchFramework iPhone 3.5-inch YES {320, 480} {480, 320} 0 IBCocoaTouchFramework view 7 carousel 13 dataSource 14 0 -1 File's Owner -2 6 12 15 ViewController com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIResponder com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarousel com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin {237, 119} com.apple.InterfaceBuilder.IBCocoaTouchPlugin 15 NSObject IBProjectSource ../../../iCarousel/iCarousel.m ViewController UIViewController carousel iCarousel carousel carousel iCarousel IBProjectSource ../iCarouselExample/ViewController.h ViewController IBProjectSource ../iCarouselExample/ViewController.m iCarousel UIView id id dataSource id delegate id IBProjectSource ../../../iCarousel/iCarousel.h iCarousel NSObject IBFrameworkSource Foundation.framework/Headers/NSError.h NSObject IBFrameworkSource Foundation.framework/Headers/NSFileManager.h NSObject IBFrameworkSource Foundation.framework/Headers/NSKeyValueCoding.h NSObject IBFrameworkSource Foundation.framework/Headers/NSKeyValueObserving.h NSObject IBFrameworkSource Foundation.framework/Headers/NSKeyedArchiver.h NSObject IBFrameworkSource Foundation.framework/Headers/NSObject.h NSObject IBFrameworkSource Foundation.framework/Headers/NSRunLoop.h NSObject IBFrameworkSource Foundation.framework/Headers/NSThread.h NSObject IBFrameworkSource Foundation.framework/Headers/NSURL.h NSObject IBFrameworkSource QuartzCore.framework/Headers/CAAnimation.h NSObject IBFrameworkSource QuartzCore.framework/Headers/CALayer.h NSObject IBFrameworkSource UIKit.framework/Headers/UIAccessibility.h NSObject IBFrameworkSource UIKit.framework/Headers/UINibLoading.h NSObject IBFrameworkSource UIKit.framework/Headers/UIResponder.h UIGestureRecognizer NSObject IBFrameworkSource UIKit.framework/Headers/UIGestureRecognizer.h UIGestureRecognizer IBFrameworkSource UIKit.framework/Headers/UIGestureRecognizerSubclass.h UIImageView UIView IBFrameworkSource UIKit.framework/Headers/UIImageView.h UIResponder NSObject UISearchBar UIView IBFrameworkSource UIKit.framework/Headers/UISearchBar.h UISearchDisplayController NSObject IBFrameworkSource UIKit.framework/Headers/UISearchDisplayController.h UIView IBFrameworkSource UIKit.framework/Headers/UIAccessibilityIdentification.h UIView IBFrameworkSource UIKit.framework/Headers/UIPrintFormatter.h UIView IBFrameworkSource UIKit.framework/Headers/UITextField.h UIView UIResponder IBFrameworkSource UIKit.framework/Headers/UIView.h UIViewController IBFrameworkSource UIKit.framework/Headers/UINavigationController.h UIViewController IBFrameworkSource UIKit.framework/Headers/UIPopoverSupport.h UIViewController IBFrameworkSource UIKit.framework/Headers/UISplitViewController.h UIViewController IBFrameworkSource UIKit.framework/Headers/UITabBarController.h UIViewController UIResponder IBFrameworkSource UIKit.framework/Headers/UIViewController.h UIViewController IBFrameworkSource UIKit.framework/Headers/UIViewControllerTransitionCoordinator.h 0 IBCocoaTouchFramework NO com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 YES 3 background.png {50, 468} ================================================ FILE: Examples/Dynamic Image Effects/iCarouselExample/iCarouselExample-Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleDisplayName ${PRODUCT_NAME} CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIconFiles CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1.0 LSRequiresIPhoneOS UIRequiredDeviceCapabilities armv7 UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight ================================================ FILE: Examples/Dynamic Image Effects/iCarouselExample/iCarouselExample-Prefix.pch ================================================ // // Prefix header for all source files of the 'ImageFXViewDemo' target in the 'ImageFXViewDemo' project // #import #ifndef __IPHONE_4_0 #warning "This project uses features only available in iOS SDK 4.0 and later." #endif #ifdef __OBJC__ #import #import #endif ================================================ FILE: Examples/Dynamic Image Effects/iCarouselExample/main.m ================================================ // // main.m // ImageFXViewDemo // // Created by Nick Lockwood on 31/10/2011. // Copyright (c) 2011 __MyCompanyName__. All rights reserved. // #import #import "AppDelegate.h" int main(int argc, char *argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } } ================================================ FILE: Examples/Dynamic Image Effects/iCarouselExample.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 018AE995179D866100FB7311 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 018AE994179D866100FB7311 /* Default-568h@2x.png */; }; 018AE999179D868F00FB7311 /* iCarousel.m in Sources */ = {isa = PBXBuildFile; fileRef = 018AE998179D868F00FB7311 /* iCarousel.m */; }; 01FA10C2145E9951001906CB /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01FA10C1145E9951001906CB /* UIKit.framework */; }; 01FA10C4145E9951001906CB /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01FA10C3145E9951001906CB /* Foundation.framework */; }; 01FA10C6145E9951001906CB /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01FA10C5145E9951001906CB /* CoreGraphics.framework */; }; 01FA10CC145E9951001906CB /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 01FA10CA145E9951001906CB /* InfoPlist.strings */; }; 01FA10CE145E9951001906CB /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 01FA10CD145E9951001906CB /* main.m */; }; 01FA10D2145E9951001906CB /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 01FA10D1145E9951001906CB /* AppDelegate.m */; }; 01FA10D5145E9951001906CB /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 01FA10D4145E9951001906CB /* ViewController.m */; }; 01FA10D8145E9951001906CB /* ViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 01FA10D6145E9951001906CB /* ViewController.xib */; }; B2F2748415A4555700513759 /* FXImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = B2F2748115A4555700513759 /* FXImageView.m */; }; B2F2748515A4555700513759 /* UIImage+FX.m in Sources */ = {isa = PBXBuildFile; fileRef = B2F2748315A4555700513759 /* UIImage+FX.m */; }; B2F274A915A457C500513759 /* Lake in Resources */ = {isa = PBXBuildFile; fileRef = B2F274A815A457C500513759 /* Lake */; }; B2F274AB15A4588000513759 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2F274AA15A4588000513759 /* QuartzCore.framework */; }; B2F274C515A45D7900513759 /* background.png in Resources */ = {isa = PBXBuildFile; fileRef = B2F274C215A45D7900513759 /* background.png */; }; B2F274C715A45D7900513759 /* placeholder.png in Resources */ = {isa = PBXBuildFile; fileRef = B2F274C415A45D7900513759 /* placeholder.png */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 018AE994179D866100FB7311 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = SOURCE_ROOT; }; 018AE997179D868F00FB7311 /* iCarousel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarousel.h; sourceTree = ""; }; 018AE998179D868F00FB7311 /* iCarousel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarousel.m; sourceTree = ""; }; 01FA10BD145E9951001906CB /* iCarouselExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iCarouselExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 01FA10C1145E9951001906CB /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 01FA10C3145E9951001906CB /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 01FA10C5145E9951001906CB /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 01FA10C9145E9951001906CB /* iCarouselExample-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "iCarouselExample-Info.plist"; sourceTree = ""; }; 01FA10CB145E9951001906CB /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 01FA10CD145E9951001906CB /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 01FA10CF145E9951001906CB /* iCarouselExample-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "iCarouselExample-Prefix.pch"; sourceTree = ""; }; 01FA10D0145E9951001906CB /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 01FA10D1145E9951001906CB /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 01FA10D3145E9951001906CB /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 01FA10D4145E9951001906CB /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 01FA10D7145E9951001906CB /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ViewController.xib; sourceTree = ""; }; B2F2748015A4555700513759 /* FXImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FXImageView.h; sourceTree = ""; }; B2F2748115A4555700513759 /* FXImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FXImageView.m; sourceTree = ""; }; B2F2748215A4555700513759 /* UIImage+FX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+FX.h"; sourceTree = ""; }; B2F2748315A4555700513759 /* UIImage+FX.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+FX.m"; sourceTree = ""; }; B2F274A815A457C500513759 /* Lake */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Lake; path = ../Lake; sourceTree = ""; }; B2F274AA15A4588000513759 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; B2F274C215A45D7900513759 /* background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = background.png; sourceTree = ""; }; B2F274C415A45D7900513759 /* placeholder.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = placeholder.png; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 01FA10BA145E9951001906CB /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( B2F274AB15A4588000513759 /* QuartzCore.framework in Frameworks */, 01FA10C2145E9951001906CB /* UIKit.framework in Frameworks */, 01FA10C4145E9951001906CB /* Foundation.framework in Frameworks */, 01FA10C6145E9951001906CB /* CoreGraphics.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 018AE996179D868F00FB7311 /* iCarousel */ = { isa = PBXGroup; children = ( 018AE997179D868F00FB7311 /* iCarousel.h */, 018AE998179D868F00FB7311 /* iCarousel.m */, ); name = iCarousel; path = ../../iCarousel; sourceTree = ""; }; 01FA10B2145E994F001906CB = { isa = PBXGroup; children = ( 018AE996179D868F00FB7311 /* iCarousel */, B2F2747F15A4555700513759 /* FXImageView */, 01FA10C7145E9951001906CB /* iCarouselExample */, 01FA10C0145E9951001906CB /* Frameworks */, 01FA10BE145E9951001906CB /* Products */, ); sourceTree = ""; }; 01FA10BE145E9951001906CB /* Products */ = { isa = PBXGroup; children = ( 01FA10BD145E9951001906CB /* iCarouselExample.app */, ); name = Products; sourceTree = ""; }; 01FA10C0145E9951001906CB /* Frameworks */ = { isa = PBXGroup; children = ( 01FA10C1145E9951001906CB /* UIKit.framework */, 01FA10C3145E9951001906CB /* Foundation.framework */, 01FA10C5145E9951001906CB /* CoreGraphics.framework */, B2F274AA15A4588000513759 /* QuartzCore.framework */, ); name = Frameworks; sourceTree = ""; }; 01FA10C7145E9951001906CB /* iCarouselExample */ = { isa = PBXGroup; children = ( 01FA10D0145E9951001906CB /* AppDelegate.h */, 01FA10D1145E9951001906CB /* AppDelegate.m */, 01FA10D3145E9951001906CB /* ViewController.h */, 01FA10D4145E9951001906CB /* ViewController.m */, 01FA10D6145E9951001906CB /* ViewController.xib */, B2F274A815A457C500513759 /* Lake */, B2F274C115A45D7900513759 /* Resources */, 01FA10C8145E9951001906CB /* Supporting Files */, ); path = iCarouselExample; sourceTree = ""; }; 01FA10C8145E9951001906CB /* Supporting Files */ = { isa = PBXGroup; children = ( 018AE994179D866100FB7311 /* Default-568h@2x.png */, 01FA10C9145E9951001906CB /* iCarouselExample-Info.plist */, 01FA10CA145E9951001906CB /* InfoPlist.strings */, 01FA10CD145E9951001906CB /* main.m */, 01FA10CF145E9951001906CB /* iCarouselExample-Prefix.pch */, ); name = "Supporting Files"; sourceTree = ""; }; B2F2747F15A4555700513759 /* FXImageView */ = { isa = PBXGroup; children = ( B2F2748015A4555700513759 /* FXImageView.h */, B2F2748115A4555700513759 /* FXImageView.m */, B2F2748215A4555700513759 /* UIImage+FX.h */, B2F2748315A4555700513759 /* UIImage+FX.m */, ); name = FXImageView; path = ../Libraries/FXImageView; sourceTree = ""; }; B2F274C115A45D7900513759 /* Resources */ = { isa = PBXGroup; children = ( B2F274C215A45D7900513759 /* background.png */, B2F274C415A45D7900513759 /* placeholder.png */, ); name = Resources; path = ../../Resources; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 01FA10BC145E9951001906CB /* iCarouselExample */ = { isa = PBXNativeTarget; buildConfigurationList = 01FA10DB145E9951001906CB /* Build configuration list for PBXNativeTarget "iCarouselExample" */; buildPhases = ( 01FA10B9145E9951001906CB /* Sources */, 01FA10BA145E9951001906CB /* Frameworks */, 01FA10BB145E9951001906CB /* Resources */, ); buildRules = ( ); dependencies = ( ); name = iCarouselExample; productName = ImageFXViewDemo; productReference = 01FA10BD145E9951001906CB /* iCarouselExample.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 01FA10B4145E994F001906CB /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0800; }; buildConfigurationList = 01FA10B7145E994F001906CB /* Build configuration list for PBXProject "iCarouselExample" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); mainGroup = 01FA10B2145E994F001906CB; productRefGroup = 01FA10BE145E9951001906CB /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 01FA10BC145E9951001906CB /* iCarouselExample */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 01FA10BB145E9951001906CB /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 01FA10CC145E9951001906CB /* InfoPlist.strings in Resources */, 01FA10D8145E9951001906CB /* ViewController.xib in Resources */, B2F274A915A457C500513759 /* Lake in Resources */, B2F274C515A45D7900513759 /* background.png in Resources */, B2F274C715A45D7900513759 /* placeholder.png in Resources */, 018AE995179D866100FB7311 /* Default-568h@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 01FA10B9145E9951001906CB /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 01FA10CE145E9951001906CB /* main.m in Sources */, 01FA10D2145E9951001906CB /* AppDelegate.m in Sources */, 01FA10D5145E9951001906CB /* ViewController.m in Sources */, B2F2748415A4555700513759 /* FXImageView.m in Sources */, B2F2748515A4555700513759 /* UIImage+FX.m in Sources */, 018AE999179D868F00FB7311 /* iCarousel.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 01FA10CA145E9951001906CB /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( 01FA10CB145E9951001906CB /* en */, ); name = InfoPlist.strings; sourceTree = ""; }; 01FA10D6145E9951001906CB /* ViewController.xib */ = { isa = PBXVariantGroup; children = ( 01FA10D7145E9951001906CB /* en */, ); name = ViewController.xib; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 01FA10D9145E9951001906CB /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; }; name = Debug; }; 01FA10DA145E9951001906CB /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = YES; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; }; name = Release; }; 01FA10DC145E9951001906CB /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_OBJC_ARC = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselExample/iCarouselExample-Prefix.pch"; INFOPLIST_FILE = "iCarouselExample/iCarouselExample-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = iCarouselExample; TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = app; }; name = Debug; }; 01FA10DD145E9951001906CB /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_OBJC_ARC = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselExample/iCarouselExample-Prefix.pch"; INFOPLIST_FILE = "iCarouselExample/iCarouselExample-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = iCarouselExample; TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = app; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 01FA10B7145E994F001906CB /* Build configuration list for PBXProject "iCarouselExample" */ = { isa = XCConfigurationList; buildConfigurations = ( 01FA10D9145E9951001906CB /* Debug */, 01FA10DA145E9951001906CB /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 01FA10DB145E9951001906CB /* Build configuration list for PBXNativeTarget "iCarouselExample" */ = { isa = XCConfigurationList; buildConfigurations = ( 01FA10DC145E9951001906CB /* Debug */, 01FA10DD145E9951001906CB /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 01FA10B4145E994F001906CB /* Project object */; } ================================================ FILE: Examples/Dynamic View Reflections/en.lproj/InfoPlist.strings ================================================ /* Localized versions of Info.plist keys */ ================================================ FILE: Examples/Dynamic View Reflections/en.lproj/MainWindow.xib ================================================ 1024 10D571 786 1038.29 460.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin 112 YES YES com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES YES YES IBFilesOwner IBCocoaTouchFramework IBFirstResponder IBCocoaTouchFramework IBCocoaTouchFramework iCarouselExampleViewController 1 IBCocoaTouchFramework NO 292 {320, 480} 1 MSAxIDEAA NO NO IBCocoaTouchFramework YES YES delegate 4 viewController 11 window 14 YES 0 -1 File's Owner 3 iCarouselExample App Delegate -2 10 12 YES YES -1.CustomClassName -2.CustomClassName 10.CustomClassName 10.IBEditorWindowLastContentRect 10.IBPluginDependency 12.IBEditorWindowLastContentRect 12.IBPluginDependency 3.CustomClassName 3.IBPluginDependency YES UIApplication UIResponder iCarouselExampleViewController {{234, 376}, {320, 480}} com.apple.InterfaceBuilder.IBCocoaTouchPlugin {{525, 346}, {320, 480}} com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarouselExampleAppDelegate com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES YES YES 15 YES UIWindow UIView IBUserSource iCarouselExampleAppDelegate NSObject YES YES viewController window YES iCarouselExampleViewController UIWindow YES YES viewController window YES viewController iCarouselExampleViewController window UIWindow IBProjectSource iCarouselExampleAppDelegate.h iCarouselExampleAppDelegate NSObject IBUserSource iCarouselExampleViewController UIViewController IBProjectSource iCarouselExampleViewController.h YES NSObject IBFrameworkSource Foundation.framework/Headers/NSError.h NSObject IBFrameworkSource Foundation.framework/Headers/NSFileManager.h NSObject IBFrameworkSource Foundation.framework/Headers/NSKeyValueCoding.h NSObject IBFrameworkSource Foundation.framework/Headers/NSKeyValueObserving.h NSObject IBFrameworkSource Foundation.framework/Headers/NSKeyedArchiver.h NSObject IBFrameworkSource Foundation.framework/Headers/NSObject.h NSObject IBFrameworkSource Foundation.framework/Headers/NSRunLoop.h NSObject IBFrameworkSource Foundation.framework/Headers/NSThread.h NSObject IBFrameworkSource Foundation.framework/Headers/NSURL.h NSObject IBFrameworkSource Foundation.framework/Headers/NSURLConnection.h NSObject IBFrameworkSource UIKit.framework/Headers/UIAccessibility.h NSObject IBFrameworkSource UIKit.framework/Headers/UINibLoading.h NSObject IBFrameworkSource UIKit.framework/Headers/UIResponder.h UIApplication UIResponder IBFrameworkSource UIKit.framework/Headers/UIApplication.h UIResponder NSObject UISearchBar UIView IBFrameworkSource UIKit.framework/Headers/UISearchBar.h UISearchDisplayController NSObject IBFrameworkSource UIKit.framework/Headers/UISearchDisplayController.h UIView IBFrameworkSource UIKit.framework/Headers/UITextField.h UIView UIResponder IBFrameworkSource UIKit.framework/Headers/UIView.h UIViewController IBFrameworkSource UIKit.framework/Headers/UINavigationController.h UIViewController IBFrameworkSource UIKit.framework/Headers/UIPopoverController.h UIViewController IBFrameworkSource UIKit.framework/Headers/UISplitViewController.h UIViewController IBFrameworkSource UIKit.framework/Headers/UITabBarController.h UIViewController UIResponder IBFrameworkSource UIKit.framework/Headers/UIViewController.h UIWindow UIView IBFrameworkSource UIKit.framework/Headers/UIWindow.h 0 IBCocoaTouchFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 YES iCarouselExample.xcodeproj 3 112 ================================================ FILE: Examples/Dynamic View Reflections/en.lproj/iCarouselExampleViewController.xib ================================================ 1280 11C74 1938 1138.23 567.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin 933 YES IBUIImageView IBUIView IBUILabel IBProxyObject YES com.apple.InterfaceBuilder.IBCocoaTouchPlugin PluginDependencyRecalculationVersion YES IBFilesOwner IBCocoaTouchFramework IBFirstResponder IBCocoaTouchFramework 274 YES 274 {320, 480} NO YES YES IBCocoaTouchFramework NSImage background.png 290 {{20, 12}, {280, 65}} _NS:328 NO YES 7 NO IBCocoaTouchFramework This example demonstrates generating reflections on-the-fly using the ReflectionView library 1 MCAwIDAAA 1 10 0 1 1 17 Helvetica 17 16 274 {{0, 57}, {320, 424}} 3 MSAwAA 2 IBCocoaTouchFramework {320, 480} 3 MQA NO IBCocoaTouchFramework YES view 7 carousel 9 dataSource 10 delegate 11 YES 0 YES -1 File's Owner -2 6 YES 8 YES iCarousel 35 36 YES YES -1.CustomClassName -1.IBPluginDependency -2.CustomClassName -2.IBPluginDependency 35.IBPluginDependency 36.IBPluginDependency 6.IBPluginDependency 8.CustomClassName 8.IBPluginDependency YES iCarouselExampleViewController com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIResponder com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarousel com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES 36 YES iCarousel UIView YES YES dataSource delegate YES id id YES YES dataSource delegate YES dataSource id delegate id IBProjectSource ./Classes/iCarousel.h iCarouselExampleViewController UIViewController carousel iCarousel carousel carousel iCarousel IBProjectSource ./Classes/iCarouselExampleViewController.h 0 IBCocoaTouchFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 YES 3 background.png {50, 468} 933 ================================================ FILE: Examples/Dynamic View Reflections/iCarouselExampleAppDelegate.h ================================================ // // iCarouselExampleAppDelegate.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import @class iCarouselExampleViewController; @interface iCarouselExampleAppDelegate : NSObject @property (nonatomic, strong) IBOutlet UIWindow *window; @property (nonatomic, strong) IBOutlet iCarouselExampleViewController *viewController; @end ================================================ FILE: Examples/Dynamic View Reflections/iCarouselExampleAppDelegate.m ================================================ // // iCarouselExampleAppDelegate.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleAppDelegate.h" #import "iCarouselExampleViewController.h" @implementation iCarouselExampleAppDelegate @synthesize window; @synthesize viewController; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { window.rootViewController = viewController; [window makeKeyAndVisible]; return YES; } @end ================================================ FILE: Examples/Dynamic View Reflections/iCarouselExampleViewController.h ================================================ // // iCarouselExampleViewController.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import #import "iCarousel.h" @interface iCarouselExampleViewController : UIViewController @property (nonatomic, strong) IBOutlet iCarousel *carousel; @end ================================================ FILE: Examples/Dynamic View Reflections/iCarouselExampleViewController.m ================================================ // // iCarouselExampleViewController.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleViewController.h" #import "ReflectionView.h" @implementation iCarouselExampleViewController @synthesize carousel; - (void)dealloc { carousel.delegate = nil; carousel.dataSource = nil; } #pragma mark - #pragma mark View lifecycle - (void)viewDidLoad { [super viewDidLoad]; //configure carousel carousel.type = iCarouselTypeCoverFlow2; } - (void)viewDidUnload { [super viewDidUnload]; self.carousel = nil; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } #pragma mark - #pragma mark iCarousel methods - (NSInteger)numberOfItemsInCarousel:(iCarousel *)carousel { //generate 100 item views //normally we'd use a backing array //as shown in the basic iOS example //but for this example we haven't bothered return 100; } - (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(ReflectionView *)view { UILabel *label = nil; //create new view if no view is available for recycling if (view == nil) { //set up reflection view view = [[ReflectionView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 200.0f, 200.0f)]; //set up content label = [[UILabel alloc] initWithFrame:view.bounds]; label.backgroundColor = [UIColor lightGrayColor]; label.layer.borderColor = [UIColor whiteColor].CGColor; label.layer.borderWidth = 4.0f; label.layer.cornerRadius = 8.0f; label.textAlignment = NSTextAlignmentCenter; label.font = [label.font fontWithSize:50]; label.tag = 9999; [view addSubview:label]; } else { label = (UILabel *)[view viewWithTag:9999]; } //set label label.text = [NSString stringWithFormat:@"%zd", index]; //update reflection //this step is expensive, so if you don't need //unique reflections for each item, don't do this //and you'll get much smoother peformance [view update]; return view; } @end ================================================ FILE: Examples/Dynamic View Reflections/iCarouselReflectionsDemo-Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleDisplayName ${PRODUCT_NAME} CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIconFile CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1.0 LSRequiresIPhoneOS NSMainNibFile MainWindow UIStatusBarHidden UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight ================================================ FILE: Examples/Dynamic View Reflections/iCarouselReflectionsDemo-Prefix.pch ================================================ // // Prefix header for all source files of the 'iCarouselExample' target in the 'iCarouselExample' project // #import #ifndef __IPHONE_3_0 #warning "This project uses features only available in iPhone SDK 3.0 and later." #endif #ifdef __OBJC__ #import #import #endif ================================================ FILE: Examples/Dynamic View Reflections/iCarouselReflectionsDemo.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 01308D9313491C3500453707 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9213491C3500453707 /* UIKit.framework */; }; 01308D9513491C3500453707 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9413491C3500453707 /* Foundation.framework */; }; 01308D9713491C3500453707 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9613491C3500453707 /* CoreGraphics.framework */; }; 01308DC013491F7200453707 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308DBF13491F7200453707 /* QuartzCore.framework */; }; 0148358813A36C2000E687AC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358313A36C2000E687AC /* main.m */; }; 0148359313A36C3700E687AC /* iCarouselExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */; }; 0148359413A36C3700E687AC /* iCarouselExampleAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */; }; 0148359513A36C3700E687AC /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0148358F13A36C3700E687AC /* MainWindow.xib */; }; 0148359613A36C3700E687AC /* iCarouselExampleViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */; }; 018AE9A6179D8F3200FB7311 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 018AE9A5179D8F3200FB7311 /* Default-568h@2x.png */; }; B29BD7B814A3476C00BB4E68 /* background.png in Resources */ = {isa = PBXBuildFile; fileRef = B29BD7B614A3476C00BB4E68 /* background.png */; }; B29BD7B914A3476C00BB4E68 /* page.png in Resources */ = {isa = PBXBuildFile; fileRef = B29BD7B714A3476C00BB4E68 /* page.png */; }; B2BCBA9B159C8DF5004942A1 /* ReflectionView.m in Sources */ = {isa = PBXBuildFile; fileRef = B2BCBA9A159C8DF5004942A1 /* ReflectionView.m */; }; B2E5E749146155E300EADB7A /* iCarousel.m in Sources */ = {isa = PBXBuildFile; fileRef = B2E5E748146155E300EADB7A /* iCarousel.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 01308D9213491C3500453707 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 01308D9413491C3500453707 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 01308D9613491C3500453707 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 01308DBF13491F7200453707 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 0148358313A36C2000E687AC /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = SOURCE_ROOT; }; 0148358413A36C2000E687AC /* iCarouselReflectionsDemo-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "iCarouselReflectionsDemo-Prefix.pch"; sourceTree = SOURCE_ROOT; }; 0148358513A36C2000E687AC /* iCarouselReflectionsDemo-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "iCarouselReflectionsDemo-Info.plist"; sourceTree = SOURCE_ROOT; }; 0148358713A36C2000E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = SOURCE_ROOT; }; 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleViewController.m; sourceTree = SOURCE_ROOT; }; 0148358C13A36C3700E687AC /* iCarouselExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleViewController.h; sourceTree = SOURCE_ROOT; }; 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleAppDelegate.m; sourceTree = SOURCE_ROOT; }; 0148358E13A36C3700E687AC /* iCarouselExampleAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleAppDelegate.h; sourceTree = SOURCE_ROOT; }; 0148359013A36C3700E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainWindow.xib; sourceTree = SOURCE_ROOT; }; 0148359213A36C3700E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/iCarouselExampleViewController.xib; sourceTree = SOURCE_ROOT; }; 018AE9A5179D8F3200FB7311 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = SOURCE_ROOT; }; 018BBCB413A375AF005CA505 /* iCarouselReflectionsDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iCarouselReflectionsDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; B29BD7B614A3476C00BB4E68 /* background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = background.png; sourceTree = ""; }; B29BD7B714A3476C00BB4E68 /* page.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = page.png; sourceTree = ""; }; B2BCBA99159C8DF5004942A1 /* ReflectionView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReflectionView.h; sourceTree = ""; }; B2BCBA9A159C8DF5004942A1 /* ReflectionView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ReflectionView.m; sourceTree = ""; }; B2E5E747146155E300EADB7A /* iCarousel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarousel.h; sourceTree = ""; }; B2E5E748146155E300EADB7A /* iCarousel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarousel.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 01308D8B13491C3500453707 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 01308DC013491F7200453707 /* QuartzCore.framework in Frameworks */, 01308D9313491C3500453707 /* UIKit.framework in Frameworks */, 01308D9513491C3500453707 /* Foundation.framework in Frameworks */, 01308D9713491C3500453707 /* CoreGraphics.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 01308D8313491C3500453707 = { isa = PBXGroup; children = ( B2E5E746146155E300EADB7A /* iCarousel */, B2BCBA98159C8DF5004942A1 /* ReflectionView */, 01308D9813491C3500453707 /* iCarouselExample */, B29BD7B514A3476C00BB4E68 /* Resources */, 01308D9113491C3500453707 /* Frameworks */, 01308D8F13491C3500453707 /* Products */, ); sourceTree = ""; }; 01308D8F13491C3500453707 /* Products */ = { isa = PBXGroup; children = ( 018BBCB413A375AF005CA505 /* iCarouselReflectionsDemo.app */, ); name = Products; sourceTree = ""; }; 01308D9113491C3500453707 /* Frameworks */ = { isa = PBXGroup; children = ( 01308DBF13491F7200453707 /* QuartzCore.framework */, 01308D9213491C3500453707 /* UIKit.framework */, 01308D9413491C3500453707 /* Foundation.framework */, 01308D9613491C3500453707 /* CoreGraphics.framework */, ); name = Frameworks; sourceTree = ""; }; 01308D9813491C3500453707 /* iCarouselExample */ = { isa = PBXGroup; children = ( 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */, 0148358C13A36C3700E687AC /* iCarouselExampleViewController.h */, 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */, 0148358E13A36C3700E687AC /* iCarouselExampleAppDelegate.h */, 0148358F13A36C3700E687AC /* MainWindow.xib */, 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */, 01308D9913491C3500453707 /* Supporting Files */, ); path = iCarouselExample; sourceTree = ""; }; 01308D9913491C3500453707 /* Supporting Files */ = { isa = PBXGroup; children = ( 018AE9A5179D8F3200FB7311 /* Default-568h@2x.png */, 0148358313A36C2000E687AC /* main.m */, 0148358413A36C2000E687AC /* iCarouselReflectionsDemo-Prefix.pch */, 0148358513A36C2000E687AC /* iCarouselReflectionsDemo-Info.plist */, 0148358613A36C2000E687AC /* InfoPlist.strings */, ); name = "Supporting Files"; sourceTree = ""; }; B29BD7B514A3476C00BB4E68 /* Resources */ = { isa = PBXGroup; children = ( B29BD7B614A3476C00BB4E68 /* background.png */, B29BD7B714A3476C00BB4E68 /* page.png */, ); name = Resources; path = ../Resources; sourceTree = ""; }; B2BCBA98159C8DF5004942A1 /* ReflectionView */ = { isa = PBXGroup; children = ( B2BCBA99159C8DF5004942A1 /* ReflectionView.h */, B2BCBA9A159C8DF5004942A1 /* ReflectionView.m */, ); name = ReflectionView; path = ../Libraries/ReflectionView; sourceTree = ""; }; B2E5E746146155E300EADB7A /* iCarousel */ = { isa = PBXGroup; children = ( B2E5E747146155E300EADB7A /* iCarousel.h */, B2E5E748146155E300EADB7A /* iCarousel.m */, ); name = iCarousel; path = ../../iCarousel; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 01308D8D13491C3500453707 /* iCarouselReflectionsDemo */ = { isa = PBXNativeTarget; buildConfigurationList = 01308DAF13491C3500453707 /* Build configuration list for PBXNativeTarget "iCarouselReflectionsDemo" */; buildPhases = ( 01308D8A13491C3500453707 /* Sources */, 01308D8B13491C3500453707 /* Frameworks */, 01308D8C13491C3500453707 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = iCarouselReflectionsDemo; productName = iCarouselExample; productReference = 018BBCB413A375AF005CA505 /* iCarouselReflectionsDemo.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 01308D8513491C3500453707 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0800; }; buildConfigurationList = 01308D8813491C3500453707 /* Build configuration list for PBXProject "iCarouselReflectionsDemo" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); mainGroup = 01308D8313491C3500453707; productRefGroup = 01308D8F13491C3500453707 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 01308D8D13491C3500453707 /* iCarouselReflectionsDemo */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 01308D8C13491C3500453707 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 0148359513A36C3700E687AC /* MainWindow.xib in Resources */, 0148359613A36C3700E687AC /* iCarouselExampleViewController.xib in Resources */, B29BD7B814A3476C00BB4E68 /* background.png in Resources */, B29BD7B914A3476C00BB4E68 /* page.png in Resources */, 018AE9A6179D8F3200FB7311 /* Default-568h@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 01308D8A13491C3500453707 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 0148358813A36C2000E687AC /* main.m in Sources */, 0148359313A36C3700E687AC /* iCarouselExampleViewController.m in Sources */, 0148359413A36C3700E687AC /* iCarouselExampleAppDelegate.m in Sources */, B2E5E749146155E300EADB7A /* iCarousel.m in Sources */, B2BCBA9B159C8DF5004942A1 /* ReflectionView.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 0148358613A36C2000E687AC /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( 0148358713A36C2000E687AC /* en */, ); name = InfoPlist.strings; sourceTree = ""; }; 0148358F13A36C3700E687AC /* MainWindow.xib */ = { isa = PBXVariantGroup; children = ( 0148359013A36C3700E687AC /* en */, ); name = MainWindow.xib; sourceTree = ""; }; 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */ = { isa = PBXVariantGroup; children = ( 0148359213A36C3700E687AC /* en */, ); name = iCarouselExampleViewController.xib; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 01308DAD13491C3500453707 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_OBJC_ARC = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = DEBUG; GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; }; name = Debug; }; 01308DAE13491C3500453707 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_OBJC_ARC = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; SDKROOT = iphoneos; }; name = Release; }; 01308DB013491C3500453707 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselReflectionsDemo-Prefix.pch"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = "iCarouselReflectionsDemo-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = iCarouselReflectionsDemo; TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = app; }; name = Debug; }; 01308DB113491C3500453707 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselReflectionsDemo-Prefix.pch"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = "iCarouselReflectionsDemo-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = iCarouselReflectionsDemo; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; WRAPPER_EXTENSION = app; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 01308D8813491C3500453707 /* Build configuration list for PBXProject "iCarouselReflectionsDemo" */ = { isa = XCConfigurationList; buildConfigurations = ( 01308DAD13491C3500453707 /* Debug */, 01308DAE13491C3500453707 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 01308DAF13491C3500453707 /* Build configuration list for PBXNativeTarget "iCarouselReflectionsDemo" */ = { isa = XCConfigurationList; buildConfigurations = ( 01308DB013491C3500453707 /* Debug */, 01308DB113491C3500453707 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 01308D8513491C3500453707 /* Project object */; } ================================================ FILE: Examples/Dynamic View Reflections/main.m ================================================ // // main.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import int main(int argc, char *argv[]) { @autoreleasepool { int retVal = UIApplicationMain(argc, argv, nil, nil); return retVal; } } ================================================ FILE: Examples/Fading Demo/en.lproj/InfoPlist.strings ================================================ /* Localized versions of Info.plist keys */ ================================================ FILE: Examples/Fading Demo/en.lproj/MainWindow.xib ================================================ 1024 10D571 786 1038.29 460.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin 112 YES YES com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES YES YES IBFilesOwner IBCocoaTouchFramework IBFirstResponder IBCocoaTouchFramework IBCocoaTouchFramework iCarouselExampleViewController 1 IBCocoaTouchFramework NO 292 {320, 480} 1 MSAxIDEAA NO NO IBCocoaTouchFramework YES YES delegate 4 viewController 11 window 14 YES 0 -1 File's Owner 3 iCarouselExample App Delegate -2 10 12 YES YES -1.CustomClassName -2.CustomClassName 10.CustomClassName 10.IBEditorWindowLastContentRect 10.IBPluginDependency 12.IBEditorWindowLastContentRect 12.IBPluginDependency 3.CustomClassName 3.IBPluginDependency YES UIApplication UIResponder iCarouselExampleViewController {{234, 376}, {320, 480}} com.apple.InterfaceBuilder.IBCocoaTouchPlugin {{525, 346}, {320, 480}} com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarouselExampleAppDelegate com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES YES YES 15 YES UIWindow UIView IBUserSource iCarouselExampleAppDelegate NSObject YES YES viewController window YES iCarouselExampleViewController UIWindow YES YES viewController window YES viewController iCarouselExampleViewController window UIWindow IBProjectSource iCarouselExampleAppDelegate.h iCarouselExampleAppDelegate NSObject IBUserSource iCarouselExampleViewController UIViewController IBProjectSource iCarouselExampleViewController.h YES NSObject IBFrameworkSource Foundation.framework/Headers/NSError.h NSObject IBFrameworkSource Foundation.framework/Headers/NSFileManager.h NSObject IBFrameworkSource Foundation.framework/Headers/NSKeyValueCoding.h NSObject IBFrameworkSource Foundation.framework/Headers/NSKeyValueObserving.h NSObject IBFrameworkSource Foundation.framework/Headers/NSKeyedArchiver.h NSObject IBFrameworkSource Foundation.framework/Headers/NSObject.h NSObject IBFrameworkSource Foundation.framework/Headers/NSRunLoop.h NSObject IBFrameworkSource Foundation.framework/Headers/NSThread.h NSObject IBFrameworkSource Foundation.framework/Headers/NSURL.h NSObject IBFrameworkSource Foundation.framework/Headers/NSURLConnection.h NSObject IBFrameworkSource UIKit.framework/Headers/UIAccessibility.h NSObject IBFrameworkSource UIKit.framework/Headers/UINibLoading.h NSObject IBFrameworkSource UIKit.framework/Headers/UIResponder.h UIApplication UIResponder IBFrameworkSource UIKit.framework/Headers/UIApplication.h UIResponder NSObject UISearchBar UIView IBFrameworkSource UIKit.framework/Headers/UISearchBar.h UISearchDisplayController NSObject IBFrameworkSource UIKit.framework/Headers/UISearchDisplayController.h UIView IBFrameworkSource UIKit.framework/Headers/UITextField.h UIView UIResponder IBFrameworkSource UIKit.framework/Headers/UIView.h UIViewController IBFrameworkSource UIKit.framework/Headers/UINavigationController.h UIViewController IBFrameworkSource UIKit.framework/Headers/UIPopoverController.h UIViewController IBFrameworkSource UIKit.framework/Headers/UISplitViewController.h UIViewController IBFrameworkSource UIKit.framework/Headers/UITabBarController.h UIViewController UIResponder IBFrameworkSource UIKit.framework/Headers/UIViewController.h UIWindow UIView IBFrameworkSource UIKit.framework/Headers/UIWindow.h 0 IBCocoaTouchFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 YES iCarouselExample.xcodeproj 3 112 ================================================ FILE: Examples/Fading Demo/en.lproj/iCarouselExampleViewController.xib ================================================ 1280 11D50 2182 1138.32 568.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin 1181 YES IBProxyObject IBUIView IBUIImageView YES com.apple.InterfaceBuilder.IBCocoaTouchPlugin PluginDependencyRecalculationVersion YES IBFilesOwner IBCocoaTouchFramework IBFirstResponder IBCocoaTouchFramework 274 YES 274 {320, 468} NO YES YES IBCocoaTouchFramework NSImage background.png 274 {320, 460} 3 MSAwAA 2 IBCocoaTouchFramework {{0, 20}, {320, 460}} 3 MC43NQA NO IBCocoaTouchFramework YES view 7 carousel 9 dataSource 10 delegate 11 YES 0 YES -1 File's Owner -2 6 YES 8 YES iCarousel 21 YES YES -1.CustomClassName -1.IBPluginDependency -2.CustomClassName -2.IBPluginDependency 21.IBPluginDependency 6.IBPluginDependency 8.CustomClassName 8.IBPluginDependency YES iCarouselExampleViewController com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIResponder com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarousel com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES 37 YES iCarousel UIView YES YES dataSource delegate YES id id YES YES dataSource delegate YES dataSource id delegate id IBProjectSource ./Classes/iCarousel.h iCarouselExampleViewController UIViewController YES YES insertItem removeItem switchCarouselType toggleOrientation toggleWrap YES id id id id id YES YES insertItem removeItem switchCarouselType toggleOrientation toggleWrap YES insertItem id removeItem id switchCarouselType id toggleOrientation id toggleWrap id YES YES carousel navItem orientationBarItem wrapBarItem YES iCarousel UINavigationItem UIBarItem UIBarItem YES YES carousel navItem orientationBarItem wrapBarItem YES carousel iCarousel navItem UINavigationItem orientationBarItem UIBarItem wrapBarItem UIBarItem IBProjectSource ./Classes/iCarouselExampleViewController.h 0 IBCocoaTouchFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 YES 3 background.png {50, 468} 1181 ================================================ FILE: Examples/Fading Demo/iCarouselExample-Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleDisplayName ${PRODUCT_NAME} CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIconFile CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1.0 LSRequiresIPhoneOS NSMainNibFile MainWindow UIStatusBarHidden UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight ================================================ FILE: Examples/Fading Demo/iCarouselExample-Prefix.pch ================================================ // // Prefix header for all source files of the 'iCarouselExample' target in the 'iCarouselExample' project // #import #ifndef __IPHONE_3_0 #warning "This project uses features only available in iPhone SDK 3.0 and later." #endif #ifdef __OBJC__ #import #import #endif ================================================ FILE: Examples/Fading Demo/iCarouselExample.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 01308D9313491C3500453707 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9213491C3500453707 /* UIKit.framework */; }; 01308D9513491C3500453707 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9413491C3500453707 /* Foundation.framework */; }; 01308D9713491C3500453707 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9613491C3500453707 /* CoreGraphics.framework */; }; 01308DC013491F7200453707 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308DBF13491F7200453707 /* QuartzCore.framework */; }; 0148358813A36C2000E687AC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358313A36C2000E687AC /* main.m */; }; 0148359313A36C3700E687AC /* iCarouselExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */; }; 0148359413A36C3700E687AC /* iCarouselExampleAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */; }; 0148359513A36C3700E687AC /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0148358F13A36C3700E687AC /* MainWindow.xib */; }; 0148359613A36C3700E687AC /* iCarouselExampleViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */; }; B2E5E6C1146145C900EADB7A /* iCarousel.m in Sources */ = {isa = PBXBuildFile; fileRef = B2E5E6C0146145C900EADB7A /* iCarousel.m */; }; B2E5E72D1461544B00EADB7A /* background.png in Resources */ = {isa = PBXBuildFile; fileRef = B2E5E72B1461544B00EADB7A /* background.png */; }; B2E5E72E1461544B00EADB7A /* page.png in Resources */ = {isa = PBXBuildFile; fileRef = B2E5E72C1461544B00EADB7A /* page.png */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 01308D9213491C3500453707 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 01308D9413491C3500453707 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 01308D9613491C3500453707 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 01308DBF13491F7200453707 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 0148358313A36C2000E687AC /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = SOURCE_ROOT; }; 0148358413A36C2000E687AC /* iCarouselExample-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "iCarouselExample-Info.plist"; sourceTree = SOURCE_ROOT; }; 0148358513A36C2000E687AC /* iCarouselExample-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "iCarouselExample-Prefix.pch"; sourceTree = SOURCE_ROOT; }; 0148358713A36C2000E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = SOURCE_ROOT; }; 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleViewController.m; sourceTree = SOURCE_ROOT; }; 0148358C13A36C3700E687AC /* iCarouselExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleViewController.h; sourceTree = SOURCE_ROOT; }; 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleAppDelegate.m; sourceTree = SOURCE_ROOT; }; 0148358E13A36C3700E687AC /* iCarouselExampleAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleAppDelegate.h; sourceTree = SOURCE_ROOT; }; 0148359013A36C3700E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainWindow.xib; sourceTree = SOURCE_ROOT; }; 0148359213A36C3700E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/iCarouselExampleViewController.xib; sourceTree = SOURCE_ROOT; }; 018BBCB413A375AF005CA505 /* iCarouselExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iCarouselExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; B2E5E6BF146145C900EADB7A /* iCarousel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarousel.h; sourceTree = ""; }; B2E5E6C0146145C900EADB7A /* iCarousel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarousel.m; sourceTree = ""; }; B2E5E72B1461544B00EADB7A /* background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = background.png; path = ../Resources/background.png; sourceTree = SOURCE_ROOT; }; B2E5E72C1461544B00EADB7A /* page.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = page.png; path = ../Resources/page.png; sourceTree = SOURCE_ROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 01308D8B13491C3500453707 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 01308DC013491F7200453707 /* QuartzCore.framework in Frameworks */, 01308D9313491C3500453707 /* UIKit.framework in Frameworks */, 01308D9513491C3500453707 /* Foundation.framework in Frameworks */, 01308D9713491C3500453707 /* CoreGraphics.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 01308D8313491C3500453707 = { isa = PBXGroup; children = ( B2E5E6BE146145C900EADB7A /* iCarousel */, 01308D9813491C3500453707 /* iCarouselExample */, 01308D9113491C3500453707 /* Frameworks */, 01308D8F13491C3500453707 /* Products */, ); sourceTree = ""; }; 01308D8F13491C3500453707 /* Products */ = { isa = PBXGroup; children = ( 018BBCB413A375AF005CA505 /* iCarouselExample.app */, ); name = Products; sourceTree = ""; }; 01308D9113491C3500453707 /* Frameworks */ = { isa = PBXGroup; children = ( 01308DBF13491F7200453707 /* QuartzCore.framework */, 01308D9213491C3500453707 /* UIKit.framework */, 01308D9413491C3500453707 /* Foundation.framework */, 01308D9613491C3500453707 /* CoreGraphics.framework */, ); name = Frameworks; sourceTree = ""; }; 01308D9813491C3500453707 /* iCarouselExample */ = { isa = PBXGroup; children = ( 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */, 0148358C13A36C3700E687AC /* iCarouselExampleViewController.h */, 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */, 0148358E13A36C3700E687AC /* iCarouselExampleAppDelegate.h */, 0148358F13A36C3700E687AC /* MainWindow.xib */, 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */, B2E5E72A1461543E00EADB7A /* Resources */, 01308D9913491C3500453707 /* Supporting Files */, ); path = iCarouselExample; sourceTree = ""; }; 01308D9913491C3500453707 /* Supporting Files */ = { isa = PBXGroup; children = ( 0148358313A36C2000E687AC /* main.m */, 0148358413A36C2000E687AC /* iCarouselExample-Info.plist */, 0148358513A36C2000E687AC /* iCarouselExample-Prefix.pch */, 0148358613A36C2000E687AC /* InfoPlist.strings */, ); name = "Supporting Files"; sourceTree = ""; }; B2E5E6BE146145C900EADB7A /* iCarousel */ = { isa = PBXGroup; children = ( B2E5E6BF146145C900EADB7A /* iCarousel.h */, B2E5E6C0146145C900EADB7A /* iCarousel.m */, ); name = iCarousel; path = ../../iCarousel; sourceTree = ""; }; B2E5E72A1461543E00EADB7A /* Resources */ = { isa = PBXGroup; children = ( B2E5E72B1461544B00EADB7A /* background.png */, B2E5E72C1461544B00EADB7A /* page.png */, ); name = Resources; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 01308D8D13491C3500453707 /* iCarouselExample */ = { isa = PBXNativeTarget; buildConfigurationList = 01308DAF13491C3500453707 /* Build configuration list for PBXNativeTarget "iCarouselExample" */; buildPhases = ( 01308D8A13491C3500453707 /* Sources */, 01308D8B13491C3500453707 /* Frameworks */, 01308D8C13491C3500453707 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = iCarouselExample; productName = iCarouselExample; productReference = 018BBCB413A375AF005CA505 /* iCarouselExample.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 01308D8513491C3500453707 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0800; }; buildConfigurationList = 01308D8813491C3500453707 /* Build configuration list for PBXProject "iCarouselExample" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); mainGroup = 01308D8313491C3500453707; productRefGroup = 01308D8F13491C3500453707 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 01308D8D13491C3500453707 /* iCarouselExample */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 01308D8C13491C3500453707 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 0148359513A36C3700E687AC /* MainWindow.xib in Resources */, 0148359613A36C3700E687AC /* iCarouselExampleViewController.xib in Resources */, B2E5E72D1461544B00EADB7A /* background.png in Resources */, B2E5E72E1461544B00EADB7A /* page.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 01308D8A13491C3500453707 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 0148358813A36C2000E687AC /* main.m in Sources */, 0148359313A36C3700E687AC /* iCarouselExampleViewController.m in Sources */, 0148359413A36C3700E687AC /* iCarouselExampleAppDelegate.m in Sources */, B2E5E6C1146145C900EADB7A /* iCarousel.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 0148358613A36C2000E687AC /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( 0148358713A36C2000E687AC /* en */, ); name = InfoPlist.strings; sourceTree = ""; }; 0148358F13A36C3700E687AC /* MainWindow.xib */ = { isa = PBXVariantGroup; children = ( 0148359013A36C3700E687AC /* en */, ); name = MainWindow.xib; sourceTree = ""; }; 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */ = { isa = PBXVariantGroup; children = ( 0148359213A36C3700E687AC /* en */, ); name = iCarouselExampleViewController.xib; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 01308DAD13491C3500453707 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = DEBUG; GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; }; name = Debug; }; 01308DAE13491C3500453707 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; SDKROOT = iphoneos; }; name = Release; }; 01308DB013491C3500453707 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselExample-Prefix.pch"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = ""; INFOPLIST_FILE = "iCarouselExample-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = iCarouselExample; TARGETED_DEVICE_FAMILY = 2; WRAPPER_EXTENSION = app; }; name = Debug; }; 01308DB113491C3500453707 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselExample-Prefix.pch"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = ""; INFOPLIST_FILE = "iCarouselExample-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = iCarouselExample; TARGETED_DEVICE_FAMILY = 2; VALIDATE_PRODUCT = YES; WRAPPER_EXTENSION = app; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 01308D8813491C3500453707 /* Build configuration list for PBXProject "iCarouselExample" */ = { isa = XCConfigurationList; buildConfigurations = ( 01308DAD13491C3500453707 /* Debug */, 01308DAE13491C3500453707 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 01308DAF13491C3500453707 /* Build configuration list for PBXNativeTarget "iCarouselExample" */ = { isa = XCConfigurationList; buildConfigurations = ( 01308DB013491C3500453707 /* Debug */, 01308DB113491C3500453707 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 01308D8513491C3500453707 /* Project object */; } ================================================ FILE: Examples/Fading Demo/iCarouselExampleAppDelegate.h ================================================ // // iCarouselExampleAppDelegate.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import @class iCarouselExampleViewController; @interface iCarouselExampleAppDelegate : NSObject @property (nonatomic, strong) IBOutlet UIWindow *window; @property (nonatomic, strong) IBOutlet iCarouselExampleViewController *viewController; @end ================================================ FILE: Examples/Fading Demo/iCarouselExampleAppDelegate.m ================================================ // // iCarouselExampleAppDelegate.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleAppDelegate.h" #import "iCarouselExampleViewController.h" @implementation iCarouselExampleAppDelegate @synthesize window; @synthesize viewController; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { window.rootViewController = viewController; [window makeKeyAndVisible]; return YES; } @end ================================================ FILE: Examples/Fading Demo/iCarouselExampleViewController.h ================================================ // // iCarouselExampleViewController.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import #import "iCarousel.h" @interface iCarouselExampleViewController : UIViewController @property (nonatomic, strong) IBOutlet iCarousel *carousel; @end ================================================ FILE: Examples/Fading Demo/iCarouselExampleViewController.m ================================================ // // iCarouselExampleViewController.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleViewController.h" @interface iCarouselExampleViewController () @property (nonatomic, strong) NSMutableArray *items; @end @implementation iCarouselExampleViewController @synthesize carousel; @synthesize items; - (void)awakeFromNib { [super awakeFromNib]; //set up data //your carousel should always be driven by an array of //data of some kind - don't store data in your item views //or the recycling mechanism will destroy your data once //your item views move off-screen self.items = [NSMutableArray array]; for (int i = 0; i < 100; i++) { [items addObject:@(i)]; } } - (void)dealloc { //it's a good idea to set these to nil here to avoid //sending messages to a deallocated viewcontroller //this is true even if your project is using ARC, unless //you are targeting iOS 5 as a minimum deployment target carousel.delegate = nil; carousel.dataSource = nil; } #pragma mark - #pragma mark View lifecycle - (void)viewDidLoad { [super viewDidLoad]; //configure carousel carousel.type = iCarouselTypeRotary; } - (void)viewDidUnload { [super viewDidUnload]; //free up memory by releasing subviews self.carousel = nil; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } #pragma mark - #pragma mark iCarousel methods - (NSInteger)numberOfItemsInCarousel:(iCarousel *)carousel { //return the total number of items in the carousel return [items count]; } - (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view { UILabel *label = nil; //create new view if no view is available for recycling if (view == nil) { //don't do anything specific to the index within //this `if (view == nil) {...}` statement because the view will be //recycled and used with other index values later view = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 200.0f, 200.0f)]; ((UIImageView *)view).image = [UIImage imageNamed:@"page.png"]; view.contentMode = UIViewContentModeCenter; label = [[UILabel alloc] initWithFrame:view.bounds]; label.backgroundColor = [UIColor clearColor]; label.textAlignment = UITextAlignmentCenter; label.font = [label.font fontWithSize:50]; label.tag = 1; [view addSubview:label]; } else { //get a reference to the label in the recycled view label = (UILabel *)[view viewWithTag:1]; } //set item label //remember to always set any properties of your carousel item //views outside of the `if (view == nil) {...}` check otherwise //you'll get weird issues with carousel item content appearing //in the wrong place in the carousel label.text = [items[index] stringValue]; return view; } - (CGFloat)carousel:(iCarousel *)carousel valueForOption:(iCarouselOption)option withDefault:(CGFloat)value { switch (option) { case iCarouselOptionFadeMin: return -0.2; case iCarouselOptionFadeMax: return 0.2; case iCarouselOptionFadeRange: return 2.0; default: return value; } } @end ================================================ FILE: Examples/Fading Demo/main.m ================================================ // // main.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import int main(int argc, char *argv[]) { @autoreleasepool { int retVal = UIApplicationMain(argc, argv, nil, nil); return retVal; } } ================================================ FILE: Examples/Libraries/AsyncImageView/AsyncImageView.h ================================================ // // AsyncImageView.h // // Version 1.5.1 // // Created by Nick Lockwood on 03/04/2011. // Copyright (c) 2011 Charcoal Design // // Distributed under the permissive zlib License // Get the latest version from here: // // https://github.com/nicklockwood/AsyncImageView // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // #import #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wobjc-missing-property-synthesis" extern NSString *const AsyncImageLoadDidFinish; extern NSString *const AsyncImageLoadDidFail; extern NSString *const AsyncImageImageKey; extern NSString *const AsyncImageURLKey; extern NSString *const AsyncImageCacheKey; extern NSString *const AsyncImageErrorKey; @interface AsyncImageLoader : NSObject + (AsyncImageLoader *)sharedLoader; + (NSCache *)defaultCache; @property (nonatomic, strong) NSCache *cache; @property (nonatomic, assign) NSUInteger concurrentLoads; @property (nonatomic, assign) NSTimeInterval loadingTimeout; - (void)loadImageWithURL:(NSURL *)URL target:(id)target success:(SEL)success failure:(SEL)failure; - (void)loadImageWithURL:(NSURL *)URL target:(id)target action:(SEL)action; - (void)loadImageWithURL:(NSURL *)URL; - (void)cancelLoadingURL:(NSURL *)URL target:(id)target action:(SEL)action; - (void)cancelLoadingURL:(NSURL *)URL target:(id)target; - (void)cancelLoadingURL:(NSURL *)URL; - (void)cancelLoadingImagesForTarget:(id)target action:(SEL)action; - (void)cancelLoadingImagesForTarget:(id)target; - (NSURL *)URLForTarget:(id)target action:(SEL)action; - (NSURL *)URLForTarget:(id)target; @end @interface UIImageView(AsyncImageView) @property (nonatomic, strong) NSURL *imageURL; @end @interface AsyncImageView : UIImageView @property (nonatomic, assign) BOOL showActivityIndicator; @property (nonatomic, assign) UIActivityIndicatorViewStyle activityIndicatorStyle; @property (nonatomic, assign) NSTimeInterval crossfadeDuration; @end #pragma GCC diagnostic pop ================================================ FILE: Examples/Libraries/AsyncImageView/AsyncImageView.m ================================================ // // AsyncImageView.m // // Version 1.5.1 // // Created by Nick Lockwood on 03/04/2011. // Copyright (c) 2011 Charcoal Design // // Distributed under the permissive zlib License // Get the latest version from here: // // https://github.com/nicklockwood/AsyncImageView // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // #import "AsyncImageView.h" #import #import #import #if !__has_feature(objc_arc) #error This class requires automatic reference counting #endif NSString *const AsyncImageLoadDidFinish = @"AsyncImageLoadDidFinish"; NSString *const AsyncImageLoadDidFail = @"AsyncImageLoadDidFail"; NSString *const AsyncImageImageKey = @"image"; NSString *const AsyncImageURLKey = @"URL"; NSString *const AsyncImageCacheKey = @"cache"; NSString *const AsyncImageErrorKey = @"error"; @interface AsyncImageConnection : NSObject @property (nonatomic, strong) NSURLConnection *connection; @property (nonatomic, strong) NSMutableData *data; @property (nonatomic, strong) NSURL *URL; @property (nonatomic, strong) NSCache *cache; @property (nonatomic, strong) id target; @property (nonatomic, assign) SEL success; @property (nonatomic, assign) SEL failure; @property (nonatomic, getter = isLoading) BOOL loading; @property (nonatomic, getter = isCancelled) BOOL cancelled; - (AsyncImageConnection *)initWithURL:(NSURL *)URL cache:(NSCache *)cache target:(id)target success:(SEL)success failure:(SEL)failure; - (void)start; - (void)cancel; - (BOOL)isInCache; @end @implementation AsyncImageConnection - (AsyncImageConnection *)initWithURL:(NSURL *)URL cache:(NSCache *)cache target:(id)target success:(SEL)success failure:(SEL)failure { if ((self = [self init])) { self.URL = URL; self.cache = cache; self.target = target; self.success = success; self.failure = failure; } return self; } - (UIImage *)cachedImage { if ([self.URL isFileURL]) { NSString *path = [[self.URL absoluteURL] path]; NSString *resourcePath = [[NSBundle mainBundle] resourcePath]; if ([path hasPrefix:resourcePath]) { return [UIImage imageNamed:[path substringFromIndex:[resourcePath length]]]; } } return [self.cache objectForKey:self.URL]; } - (BOOL)isInCache { return [self cachedImage] != nil; } - (void)loadFailedWithError:(NSError *)error { self.loading = NO; self.cancelled = NO; [[NSNotificationCenter defaultCenter] postNotificationName:AsyncImageLoadDidFail object:self.target userInfo:@{AsyncImageURLKey: self.URL, AsyncImageErrorKey: error}]; } - (void)cacheImage:(UIImage *)image { if (!self.cancelled) { if (image && self.URL) { BOOL storeInCache = YES; if ([self.URL isFileURL]) { if ([[[self.URL absoluteURL] path] hasPrefix:[[NSBundle mainBundle] resourcePath]]) { //do not store in cache storeInCache = NO; } } if (storeInCache) { [self.cache setObject:image forKey:self.URL]; } } NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithObjectsAndKeys: image, AsyncImageImageKey, self.URL, AsyncImageURLKey, nil]; if (self.cache) { userInfo[AsyncImageCacheKey] = self.cache; } self.loading = NO; [[NSNotificationCenter defaultCenter] postNotificationName:AsyncImageLoadDidFinish object:self.target userInfo:[userInfo copy]]; } else { self.loading = NO; self.cancelled = NO; } } - (void)processDataInBackground:(NSData *)data { @synchronized ([self class]) { if (!self.cancelled) { UIImage *image = [[UIImage alloc] initWithData:data]; if (image) { //redraw to prevent deferred decompression UIGraphicsBeginImageContextWithOptions(image.size, NO, image.scale); [image drawAtPoint:CGPointZero]; image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); //add to cache (may be cached already but it doesn't matter) [self performSelectorOnMainThread:@selector(cacheImage:) withObject:image waitUntilDone:YES]; } else { @autoreleasepool { NSError *error = [NSError errorWithDomain:@"AsyncImageLoader" code:0 userInfo:@{NSLocalizedDescriptionKey: @"Invalid image data"}]; [self performSelectorOnMainThread:@selector(loadFailedWithError:) withObject:error waitUntilDone:YES]; } } } else { //clean up [self performSelectorOnMainThread:@selector(cacheImage:) withObject:nil waitUntilDone:YES]; } } } - (void)connection:(__unused NSURLConnection *)connection didReceiveResponse:(__unused NSURLResponse *)response { self.data = [NSMutableData data]; } - (void)connection:(__unused NSURLConnection *)connection didReceiveData:(NSData *)data { //add data [self.data appendData:data]; } - (void)connectionDidFinishLoading:(__unused NSURLConnection *)connection { [self performSelectorInBackground:@selector(processDataInBackground:) withObject:self.data]; self.connection = nil; self.data = nil; } - (void)connection:(__unused NSURLConnection *)connection didFailWithError:(NSError *)error { self.connection = nil; self.data = nil; [self loadFailedWithError:error]; } - (void)start { if (self.loading && !self.cancelled) { return; } //begin loading self.loading = YES; self.cancelled = NO; //check for nil URL if (self.URL == nil) { [self cacheImage:nil]; return; } //check for cached image UIImage *image = [self cachedImage]; if (image) { //add to cache (cached already but it doesn't matter) [self performSelectorOnMainThread:@selector(cacheImage:) withObject:image waitUntilDone:NO]; return; } //begin load NSURLRequest *request = [NSURLRequest requestWithURL:self.URL cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:[AsyncImageLoader sharedLoader].loadingTimeout]; self.connection = [[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:NO]; [self.connection scheduleInRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes]; [self.connection start]; } - (void)cancel { self.cancelled = YES; [self.connection cancel]; self.connection = nil; self.data = nil; } @end @interface AsyncImageLoader () @property (nonatomic, strong) NSMutableArray *connections; @end @implementation AsyncImageLoader + (AsyncImageLoader *)sharedLoader { static AsyncImageLoader *sharedInstance = nil; if (sharedInstance == nil) { sharedInstance = [(AsyncImageLoader *)[self alloc] init]; } return sharedInstance; } + (NSCache *)defaultCache { static NSCache *sharedCache = nil; if (sharedCache == nil) { sharedCache = [[NSCache alloc] init]; [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidReceiveMemoryWarningNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(__unused NSNotification *note) { [sharedCache removeAllObjects]; }]; } return sharedCache; } - (AsyncImageLoader *)init { if ((self = [super init])) { self.cache = [[self class] defaultCache]; _concurrentLoads = 2; _loadingTimeout = 60.0; _connections = [[NSMutableArray alloc] init]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(imageLoaded:) name:AsyncImageLoadDidFinish object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(imageFailed:) name:AsyncImageLoadDidFail object:nil]; } return self; } - (void)updateQueue { //start connections NSUInteger count = 0; for (AsyncImageConnection *connection in self.connections) { if (![connection isLoading]) { if ([connection isInCache]) { [connection start]; } else if (count < self.concurrentLoads) { count ++; [connection start]; } } } } - (void)imageLoaded:(NSNotification *)notification { //complete connections for URL NSURL *URL = (notification.userInfo)[AsyncImageURLKey]; for (NSInteger i = (NSInteger)[self.connections count] - 1; i >= 0; i--) { AsyncImageConnection *connection = self.connections[(NSUInteger)i]; if (connection.URL == URL || [connection.URL isEqual:URL]) { //cancel earlier connections for same target/action for (NSInteger j = i - 1; j >= 0; j--) { AsyncImageConnection *earlier = self.connections[(NSUInteger)j]; if (earlier.target == connection.target && earlier.success == connection.success) { [earlier cancel]; [self.connections removeObjectAtIndex:(NSUInteger)j]; i--; } } //cancel connection (in case it's a duplicate) [connection cancel]; //perform action UIImage *image = (notification.userInfo)[AsyncImageImageKey]; ((void (*)(id, SEL, id, id))objc_msgSend)(connection.target, connection.success, image, connection.URL); //remove from queue [self.connections removeObjectAtIndex:(NSUInteger)i]; } } //update the queue [self updateQueue]; } - (void)imageFailed:(NSNotification *)notification { //remove connections for URL NSURL *URL = (notification.userInfo)[AsyncImageURLKey]; for (NSInteger i = (NSInteger)[self.connections count] - 1; i >= 0; i--) { AsyncImageConnection *connection = self.connections[(NSUInteger)i]; if ([connection.URL isEqual:URL]) { //cancel connection (in case it's a duplicate) [connection cancel]; //perform failure action if (connection.failure) { NSError *error = (notification.userInfo)[AsyncImageErrorKey]; ((void (*)(id, SEL, id, id))objc_msgSend)(connection.target, connection.failure, error, URL); } //remove from queue [self.connections removeObjectAtIndex:(NSUInteger)i]; } } //update the queue [self updateQueue]; } - (void)loadImageWithURL:(NSURL *)URL target:(id)target success:(SEL)success failure:(SEL)failure { //check cache UIImage *image = [self.cache objectForKey:URL]; if (image) { [self cancelLoadingImagesForTarget:self action:success]; if (success) { dispatch_async(dispatch_get_main_queue(), ^(void) { ((void (*)(id, SEL, id, id))objc_msgSend)(target, success, image, URL); }); } return; } //create new connection AsyncImageConnection *connection = [[AsyncImageConnection alloc] initWithURL:URL cache:self.cache target:target success:success failure:failure]; BOOL added = NO; for (NSUInteger i = 0; i < [self.connections count]; i++) { AsyncImageConnection *existingConnection = self.connections[i]; if (!existingConnection.loading) { [self.connections insertObject:connection atIndex:i]; added = YES; break; } } if (!added) { [self.connections addObject:connection]; } [self updateQueue]; } - (void)loadImageWithURL:(NSURL *)URL target:(id)target action:(SEL)action { [self loadImageWithURL:URL target:target success:action failure:NULL]; } - (void)loadImageWithURL:(NSURL *)URL { [self loadImageWithURL:URL target:nil success:NULL failure:NULL]; } - (void)cancelLoadingURL:(NSURL *)URL target:(id)target action:(SEL)action { for (NSInteger i = (NSInteger)[self.connections count] - 1; i >= 0; i--) { AsyncImageConnection *connection = self.connections[(NSUInteger)i]; if ([connection.URL isEqual:URL] && connection.target == target && connection.success == action) { [connection cancel]; [self.connections removeObjectAtIndex:(NSUInteger)i]; } } } - (void)cancelLoadingURL:(NSURL *)URL target:(id)target { for (NSInteger i = (NSInteger)[self.connections count] - 1; i >= 0; i--) { AsyncImageConnection *connection = self.connections[(NSUInteger)i]; if ([connection.URL isEqual:URL] && connection.target == target) { [connection cancel]; [self.connections removeObjectAtIndex:(NSUInteger)i]; } } } - (void)cancelLoadingURL:(NSURL *)URL { for (NSInteger i = (NSInteger)[self.connections count] - 1; i >= 0; i--) { AsyncImageConnection *connection = self.connections[(NSUInteger)i]; if ([connection.URL isEqual:URL]) { [connection cancel]; [self.connections removeObjectAtIndex:(NSUInteger)i]; } } } - (void)cancelLoadingImagesForTarget:(id)target action:(SEL)action { for (NSInteger i = (NSInteger)[self.connections count] - 1; i >= 0; i--) { AsyncImageConnection *connection = self.connections[(NSUInteger)i]; if (connection.target == target && connection.success == action) { [connection cancel]; } } } - (void)cancelLoadingImagesForTarget:(id)target { for (NSInteger i = (NSInteger)[self.connections count] - 1; i >= 0; i--) { AsyncImageConnection *connection = self.connections[(NSUInteger)i]; if (connection.target == target) { [connection cancel]; } } } - (NSURL *)URLForTarget:(id)target action:(SEL)action { //return the most recent image URL assigned to the target for the given action //this is not neccesarily the next image that will be assigned for (NSInteger i = (NSInteger)[self.connections count] - 1; i >= 0; i--) { AsyncImageConnection *connection = self.connections[(NSUInteger)i]; if (connection.target == target && connection.success == action) { return connection.URL; } } return nil; } - (NSURL *)URLForTarget:(id)target { //return the most recent image URL assigned to the target //this is not neccesarily the next image that will be assigned for (NSInteger i = (NSInteger)[self.connections count] - 1; i >= 0; i--) { AsyncImageConnection *connection = self.connections[(NSUInteger)i]; if (connection.target == target) { return connection.URL; } } return nil; } - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; } @end @implementation UIImageView(AsyncImageView) - (void)setImageURL:(NSURL *)imageURL { [[AsyncImageLoader sharedLoader] loadImageWithURL:imageURL target:self action:@selector(setImage:)]; } - (NSURL *)imageURL { return [[AsyncImageLoader sharedLoader] URLForTarget:self action:@selector(setImage:)]; } @end @interface AsyncImageView () @property (nonatomic, strong) UIActivityIndicatorView *activityView; @end @implementation AsyncImageView - (void)setUp { self.showActivityIndicator = (self.image == nil); self.activityIndicatorStyle = UIActivityIndicatorViewStyleGray; self.crossfadeDuration = 0.4; } - (id)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { [self setUp]; } return self; } - (id)initWithCoder:(NSCoder *)aDecoder { if ((self = [super initWithCoder:aDecoder])) { [self setUp]; } return self; } - (void)setImageURL:(NSURL *)imageURL { UIImage *image = [[AsyncImageLoader sharedLoader].cache objectForKey:imageURL]; if (image) { self.image = image; return; } super.imageURL = imageURL; if (self.showActivityIndicator && !self.image && imageURL) { if (self.activityView == nil) { self.activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:self.activityIndicatorStyle]; self.activityView.hidesWhenStopped = YES; self.activityView.center = CGPointMake(self.bounds.size.width / 2.0f, self.bounds.size.height / 2.0f); self.activityView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin; [self addSubview:self.activityView]; } [self.activityView startAnimating]; } } - (void)setActivityIndicatorStyle:(UIActivityIndicatorViewStyle)style { _activityIndicatorStyle = style; [self.activityView removeFromSuperview]; self.activityView = nil; } - (void)setImage:(UIImage *)image { if (image != self.image && self.crossfadeDuration) { //jump through a few hoops to avoid QuartzCore framework dependency CAAnimation *animation = [NSClassFromString(@"CATransition") animation]; [animation setValue:@"kCATransitionFade" forKey:@"type"]; animation.duration = self.crossfadeDuration; [self.layer addAnimation:animation forKey:nil]; } super.image = image; [self.activityView stopAnimating]; } - (void)dealloc { [[AsyncImageLoader sharedLoader] cancelLoadingURL:self.imageURL target:self]; } @end ================================================ FILE: Examples/Libraries/FXImageView/FXImageView.h ================================================ // // FXImageView.h // // Version 1.3.5 // // Created by Nick Lockwood on 31/10/2011. // Copyright (c) 2011 Charcoal Design // // Distributed under the permissive zlib License // Get the latest version from here: // // https://github.com/nicklockwood/FXImageView // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wobjc-missing-property-synthesis" #import #import @interface FXImageView : UIImageView + (NSOperationQueue *)processingQueue; + (NSCache *)processedImageCache; @property (nonatomic, assign, getter = isAsynchronous) BOOL asynchronous; @property (nonatomic, assign) NSTimeInterval crossfadeDuration; @property (nonatomic, assign) CGFloat reflectionGap; @property (nonatomic, assign) CGFloat reflectionScale; @property (nonatomic, assign) CGFloat reflectionAlpha; @property (nonatomic, strong) UIColor *shadowColor; @property (nonatomic, assign) CGSize shadowOffset; @property (nonatomic, assign) CGFloat shadowBlur; @property (nonatomic, assign) CGFloat cornerRadius; @property (nonatomic, strong) UIImage *processedImage; @property (nonatomic, assign) UIViewContentMode contentMode; @property (nonatomic, copy) UIImage *(^customEffectsBlock)(UIImage *image); @property (nonatomic, copy) NSString *cacheKey; - (void)setImageWithContentsOfFile:(NSString *)file; - (void)setImageWithContentsOfURL:(NSURL *)URL; @end #pragma GCC diagnostic pop ================================================ FILE: Examples/Libraries/FXImageView/FXImageView.m ================================================ // // FXImageView.m // // Version 1.3.5 // // Created by Nick Lockwood on 31/10/2011. // Copyright (c) 2011 Charcoal Design // // Distributed under the permissive zlib License // Get the latest version from here: // // https://github.com/nicklockwood/FXImageView // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // #import "FXImageView.h" #import "UIImage+FX.h" #import #pragma GCC diagnostic ignored "-Wobjc-missing-property-synthesis" #pragma GCC diagnostic ignored "-Wdirect-ivar-access" #pragma GCC diagnostic ignored "-Wconversion" #pragma GCC diagnostic ignored "-Wgnu" #import #if !__has_feature(objc_arc) #error This class requires automatic reference counting #endif @interface FXImageOperation : NSOperation @property (nonatomic, strong) FXImageView *target; @end @interface FXImageView () @property (nonatomic, strong) UIImage *originalImage; @property (nonatomic, strong) NSURL *imageContentURL; - (void)processImage; @end @implementation FXImageOperation - (void)main { @autoreleasepool { [_target processImage]; } } @end @implementation FXImageView @synthesize cacheKey = _cacheKey; @synthesize contentMode = _contentMode; #pragma mark - #pragma mark Shared storage + (NSOperationQueue *)processingQueue { static NSOperationQueue *sharedQueue = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ sharedQueue = [[NSOperationQueue alloc] init]; [sharedQueue setMaxConcurrentOperationCount:4]; }); return sharedQueue; } + (NSCache *)processedImageCache { static NSCache *sharedCache = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ sharedCache = [[NSCache alloc] init]; [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidReceiveMemoryWarningNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(__unused NSNotification *note) { [sharedCache removeAllObjects]; }]; }); return sharedCache; } #pragma mark - #pragma mark Setup - (void)setUp { self.shadowColor = [UIColor blackColor]; _crossfadeDuration = 0.25; super.contentMode = UIViewContentModeCenter; self.image = super.image; super.image = nil; } - (id)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { [self setUp]; } return self; } - (id)initWithImage:(UIImage *)image { if ((self = [super initWithImage:image])) { [self setUp]; } return self; } - (id)initWithImage:(UIImage *)image highlightedImage:(UIImage *)highlightedImage { if ((self = [super initWithImage:image highlightedImage:highlightedImage])) { [self setUp]; } return self; } - (void)awakeFromNib { [super awakeFromNib]; [self setUp]; } #pragma mark - #pragma mark Caching - (NSString *)colorHash:(UIColor *)color { NSString *colorString = @"{0.00, 0.00}"; if (color && ![color isEqual:[UIColor clearColor]]) { size_t componentCount = CGColorGetNumberOfComponents(color.CGColor); const CGFloat *components = CGColorGetComponents(color.CGColor); NSMutableArray *parts = [NSMutableArray arrayWithCapacity:componentCount]; for (size_t i = 0; i < componentCount; i++) { [parts addObject:[NSString stringWithFormat:@"%.2f", components[i]]]; } colorString = [NSString stringWithFormat:@"{%@}", [parts componentsJoinedByString:@", "]]; } return colorString; } - (NSNumber *)imageHash:(UIImage *)image { @synchronized([self class]) { static NSUInteger hashKey = 1; static const void *FXImageHashKey = &FXImageHashKey; NSNumber *number = objc_getAssociatedObject(image, FXImageHashKey); if (!number && image) { objc_setAssociatedObject(image, FXImageHashKey, @(hashKey++), OBJC_ASSOCIATION_RETAIN_NONATOMIC); } return number; } } - (NSString *)cacheKey { if (_cacheKey) return _cacheKey; return [NSString stringWithFormat:@"%@_%@_%.2f_%.2f_%.2f_%@_%@_%.2f_%.2f_%@", _imageContentURL ?: [self imageHash:_originalImage], NSStringFromCGSize(self.bounds.size), _reflectionGap, _reflectionScale, _reflectionAlpha, [self colorHash:_shadowColor], NSStringFromCGSize(_shadowOffset), _shadowBlur, _cornerRadius, @(self.contentMode)]; } - (void)cacheProcessedImage:(UIImage *)processedImage forKey:(NSString *)cacheKey { [[[self class] processedImageCache] setObject:processedImage forKey:cacheKey]; } - (UIImage *)cachedProcessedImage { return [[[self class] processedImageCache] objectForKey:[self cacheKey]]; } #pragma mark - #pragma mark Processing - (void)setProcessedImageOnMainThread:(NSArray *)array { //get images NSString *cacheKey = array[1]; UIImage *processedImage = array[0]; processedImage = ([processedImage isKindOfClass:[NSNull class]])? nil: processedImage; if (processedImage) { //cache image [self cacheProcessedImage:processedImage forKey:cacheKey]; //set image if ([[self cacheKey] isEqualToString:cacheKey]) { if (_crossfadeDuration) { //jump through a few hoops to avoid QuartzCore framework dependency CAAnimation *animation = [NSClassFromString(@"CATransition") animation]; [animation setValue:@"kCATransitionFade" forKey:@"type"]; animation.duration = _crossfadeDuration; [self.layer addAnimation:animation forKey:nil]; } //set processed image [self setProcessedImageInternal:processedImage]; } } } - (void)processImage { //get properties NSString *cacheKey = [self cacheKey]; UIImage *image = _originalImage; NSURL *imageURL = _imageContentURL; CGSize size = self.bounds.size; CGFloat reflectionGap = _reflectionGap; CGFloat reflectionScale = _reflectionScale; CGFloat reflectionAlpha = _reflectionAlpha; UIColor *shadowColor = _shadowColor; CGSize shadowOffset = _shadowOffset; CGFloat shadowBlur = _shadowBlur; CGFloat cornerRadius = _cornerRadius; UIImage *(^customEffectsBlock)(UIImage *image) = [_customEffectsBlock copy]; UIViewContentMode contentMode = self.contentMode; //check cache UIImage *processedImage = [self cachedProcessedImage]; if (!processedImage) { //load image if (imageURL) { NSURLRequest *request = [NSURLRequest requestWithURL:imageURL cachePolicy:NSURLRequestReturnCacheDataElseLoad timeoutInterval:30.0]; NSError *error = nil; NSURLResponse *response = nil; NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error]; if (error) { NSLog(@"Error loading image for URL: %@, %@", imageURL, error); image = nil; } else { image = [UIImage imageWithData:data]; if ([[[imageURL path] stringByDeletingPathExtension] hasSuffix:@"@2x"]) { image = [UIImage imageWithCGImage:image.CGImage scale:2.0f orientation:image.imageOrientation]; } } } if (image) { //crop and scale image processedImage = [image imageCroppedAndScaledToSize:size contentMode:contentMode padToFit:NO]; //apply custom processing if (customEffectsBlock) { processedImage = customEffectsBlock(processedImage); } //clip corners if (cornerRadius) { processedImage = [processedImage imageWithCornerRadius:cornerRadius]; } //apply shadow if (shadowColor && ![shadowColor isEqual:[UIColor clearColor]] && (shadowBlur || !CGSizeEqualToSize(shadowOffset, CGSizeZero))) { reflectionGap -= 2.0f * (fabsf(shadowOffset.height) + shadowBlur); processedImage = [processedImage imageWithShadowColor:shadowColor offset:shadowOffset blur:shadowBlur]; } //apply reflection if (reflectionScale && reflectionAlpha) { processedImage = [processedImage imageWithReflectionWithScale:reflectionScale gap:reflectionGap alpha:reflectionAlpha]; } } } //cache and set image if ([[NSThread currentThread] isMainThread]) { if (processedImage) { [self cacheProcessedImage:processedImage forKey:cacheKey]; } [self setProcessedImageInternal:processedImage]; } else { [self performSelectorOnMainThread:@selector(setProcessedImageOnMainThread:) withObject:@[processedImage ?: [NSNull null], cacheKey] waitUntilDone:YES]; } } - (void)queueProcessingOperation:(FXImageOperation *)operation { //suspend operation queue NSOperationQueue *queue = [[self class] processingQueue]; [queue setSuspended:YES]; //check for existing operations for (FXImageOperation *op in queue.operations) { if ([op isKindOfClass:[FXImageOperation class]]) { if (op.target == self && ![op isExecuting]) { //already queued [queue setSuspended:NO]; return; } } } //make op a dependency of all queued ops NSInteger maxOperations = ([queue maxConcurrentOperationCount] > 0) ? [queue maxConcurrentOperationCount]: INT_MAX; NSInteger index = [queue operationCount] - maxOperations; if (index >= 0) { NSOperation *op = [queue operations][index]; if (![op isExecuting]) { [op addDependency:operation]; } } //add operation to queue [queue addOperation:operation]; //resume queue [queue setSuspended:NO]; } - (void)queueImageForProcessing { //create processing operation FXImageOperation *operation = [[FXImageOperation alloc] init]; operation.target = self; //set operation thread priority #if __IPHONE_OS_VERSION_MIN_REQUIRED < 80000 #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000 if (![operation respondsToSelector:@selector(setQualityOfService:)]) { #endif [operation setThreadPriority:1.0]; #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000 } else #endif #endif { #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000 [operation setQualityOfService:NSQualityOfServiceUtility]; #endif } //queue operation [self queueProcessingOperation:operation]; } - (void)updateProcessedImage { id processedImage = [self cachedProcessedImage]; if (!processedImage && !_originalImage && !_imageContentURL) { processedImage = [NSNull null]; } if (processedImage) { //use cached version [self setProcessedImageInternal:[processedImage isKindOfClass:[NSNull class]]? nil: processedImage]; } else if (_asynchronous) { //process in background [self queueImageForProcessing]; } else { //process on main thread [self processImage]; } } - (void)layoutSubviews { [super layoutSubviews]; if (_imageContentURL || self.image) { [self updateProcessedImage]; } } - (void)didMoveToWindow { if (self.window && (id)self.processedImage.CGImage != self.layer.contents) { //fixes issue where image would be reset to unprocessed version //if offscreen layer contents was cleared due to memory warning [self setProcessedImageInternal:self.processedImage]; } } #pragma mark - #pragma mark Setters and getters - (void)setProcessedImage:(UIImage *)processedImage { self.imageContentURL = nil; if (self.originalImage) { [self willChangeValueForKey:@"image"]; self.originalImage = nil; [self didChangeValueForKey:@"image"]; } [self setProcessedImageInternal:processedImage]; } - (void)setProcessedImageInternal:(UIImage *)processedImage { [self willChangeValueForKey:@"processedImage"]; _processedImage = processedImage; self.layer.contentsScale = processedImage.scale; self.layer.contents = (id)_processedImage.CGImage; [self didChangeValueForKey:@"processedImage"]; } - (UIImage *)image { return _originalImage; } - (void)setImage:(UIImage *)image { if (_imageContentURL || ![image isEqual:_originalImage]) { //update processed image self.imageContentURL = nil; self.originalImage = image; [self updateProcessedImage]; } } - (void)setHighlighted:(__unused BOOL)highlighted { //highlighted images are not currently supported } - (void)setReflectionGap:(CGFloat)reflectionGap { if (fabs(_reflectionGap - reflectionGap) > 0.001) { _reflectionGap = reflectionGap; [self setNeedsLayout]; } } - (void)setReflectionScale:(CGFloat)reflectionScale { if (fabs(_reflectionScale - reflectionScale) > 0.001) { _reflectionScale = reflectionScale; [self setNeedsLayout]; } } - (void)setReflectionAlpha:(CGFloat)reflectionAlpha { if (fabs(_reflectionAlpha - reflectionAlpha) > 0.001) { _reflectionAlpha = reflectionAlpha; [self setNeedsLayout]; } } - (void)setShadowColor:(UIColor *)shadowColor { if (![_shadowColor isEqual:shadowColor]) { _shadowColor = shadowColor; [self setNeedsLayout]; } } - (void)setShadowOffset:(CGSize)shadowOffset { if (!CGSizeEqualToSize(_shadowOffset, shadowOffset)) { _shadowOffset = shadowOffset; [self setNeedsLayout]; } } - (void)setShadowBlur:(CGFloat)shadowBlur { if (fabs(_shadowBlur - shadowBlur) > 0.001) { _shadowBlur = shadowBlur; [self setNeedsLayout]; } } - (void)setCornerRadius:(CGFloat)cornerRadius { if (fabs(_cornerRadius - cornerRadius) > 0.001) { _cornerRadius = cornerRadius; [self setNeedsLayout]; } } - (void)setContentMode:(UIViewContentMode)contentMode { if (_contentMode != contentMode) { _contentMode = contentMode; [self setNeedsLayout]; } } - (void)setCustomEffectsBlock:(UIImage *(^)(UIImage *))customEffectsBlock { if (![customEffectsBlock isEqual:_customEffectsBlock]) { _customEffectsBlock = [customEffectsBlock copy]; [self setNeedsLayout]; } } - (void)setCacheKey:(NSString *)cacheKey { if (![cacheKey isEqualToString:_cacheKey]) { _cacheKey = [cacheKey copy]; [self setNeedsLayout]; } } #pragma mark - #pragma mark loading - (void)setImageWithContentsOfFile:(NSString *)file { if ([[file pathExtension] length] == 0) { file = [file stringByAppendingPathExtension:@"png"]; } if (![file isAbsolutePath]) { file = [[NSBundle mainBundle] pathForResource:file ofType:nil]; } if ([UIScreen mainScreen].scale == 2.0f) { NSString *temp = [[[file stringByDeletingPathExtension] stringByAppendingString:@"@2x"] stringByAppendingPathExtension:[file pathExtension]]; if ([[NSFileManager defaultManager] fileExistsAtPath:temp]) { file = temp; } } [self setImageWithContentsOfURL:[NSURL fileURLWithPath:file]]; } - (void)setImageWithContentsOfURL:(NSURL *)URL { if (![URL isEqual:_imageContentURL]) { //update processed image [self willChangeValueForKey:@"image"]; self.originalImage = nil; [self didChangeValueForKey:@"image"]; self.imageContentURL = URL; [self updateProcessedImage]; } } @end ================================================ FILE: Examples/Libraries/FXImageView/UIImage+FX.h ================================================ // // UIImage+FX.h // // Version 1.3.5 // // Created by Nick Lockwood on 31/10/2011. // Copyright (c) 2011 Charcoal Design // // Distributed under the permissive zlib License // Get the latest version from here: // // https://github.com/nicklockwood/FXImageView // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // #import @interface UIImage (FX) - (UIImage *)imageCroppedToRect:(CGRect)rect; - (UIImage *)imageScaledToSize:(CGSize)size; - (UIImage *)imageScaledToFitSize:(CGSize)size; - (UIImage *)imageScaledToFillSize:(CGSize)size; - (UIImage *)imageCroppedAndScaledToSize:(CGSize)size contentMode:(UIViewContentMode)contentMode padToFit:(BOOL)padToFit; - (UIImage *)reflectedImageWithScale:(CGFloat)scale; - (UIImage *)imageWithReflectionWithScale:(CGFloat)scale gap:(CGFloat)gap alpha:(CGFloat)alpha; - (UIImage *)imageWithShadowColor:(UIColor *)color offset:(CGSize)offset blur:(CGFloat)blur; - (UIImage *)imageWithCornerRadius:(CGFloat)radius; - (UIImage *)imageWithAlpha:(CGFloat)alpha; - (UIImage *)imageWithMask:(UIImage *)maskImage; - (UIImage *)maskImageFromImageAlpha; @end ================================================ FILE: Examples/Libraries/FXImageView/UIImage+FX.m ================================================ // // UIImage+FX.m // // Version 1.3.5 // // Created by Nick Lockwood on 31/10/2011. // Copyright (c) 2011 Charcoal Design // // Distributed under the permissive zlib License // Get the latest version from here: // // https://github.com/nicklockwood/FXImageView // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // #import "UIImage+FX.h" #pragma GCC diagnostic ignored "-Wconversion" @implementation UIImage (FX) - (UIImage *)imageCroppedToRect:(CGRect)rect { //create drawing context UIGraphicsBeginImageContextWithOptions(rect.size, NO, 0.0f); //draw [self drawAtPoint:CGPointMake(-rect.origin.x, -rect.origin.y)]; //capture resultant image UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); //return image return image; } - (UIImage *)imageScaledToSize:(CGSize)size { //avoid redundant drawing if (CGSizeEqualToSize(self.size, size)) { return self; } //create drawing context UIGraphicsBeginImageContextWithOptions(size, NO, 0.0f); //draw [self drawInRect:CGRectMake(0.0f, 0.0f, size.width, size.height)]; //capture resultant image UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); //return image return image; } - (UIImage *)imageScaledToFitSize:(CGSize)size { //calculate rect CGFloat aspect = self.size.width / self.size.height; if (size.width / aspect <= size.height) { return [self imageScaledToSize:CGSizeMake(size.width, size.width / aspect)]; } else { return [self imageScaledToSize:CGSizeMake(size.height * aspect, size.height)]; } } - (UIImage *)imageScaledToFillSize:(CGSize)size { if (CGSizeEqualToSize(self.size, size)) { return self; } //calculate rect CGFloat aspect = self.size.width / self.size.height; if (size.width / aspect >= size.height) { return [self imageScaledToSize:CGSizeMake(size.width, size.width / aspect)]; } else { return [self imageScaledToSize:CGSizeMake(size.height * aspect, size.height)]; } } - (UIImage *)imageCroppedAndScaledToSize:(CGSize)size contentMode:(UIViewContentMode)contentMode padToFit:(BOOL)padToFit { //calculate rect CGRect rect = CGRectZero; switch (contentMode) { case UIViewContentModeScaleAspectFit: { CGFloat aspect = self.size.width / self.size.height; if (size.width / aspect <= size.height) { rect = CGRectMake(0.0f, (size.height - size.width / aspect) / 2.0f, size.width, size.width / aspect); } else { rect = CGRectMake((size.width - size.height * aspect) / 2.0f, 0.0f, size.height * aspect, size.height); } break; } case UIViewContentModeScaleAspectFill: { CGFloat aspect = self.size.width / self.size.height; if (size.width / aspect >= size.height) { rect = CGRectMake(0.0f, (size.height - size.width / aspect) / 2.0f, size.width, size.width / aspect); } else { rect = CGRectMake((size.width - size.height * aspect) / 2.0f, 0.0f, size.height * aspect, size.height); } break; } case UIViewContentModeCenter: { rect = CGRectMake((size.width - self.size.width) / 2.0f, (size.height - self.size.height) / 2.0f, self.size.width, self.size.height); break; } case UIViewContentModeTop: { rect = CGRectMake((size.width - self.size.width) / 2.0f, 0.0f, self.size.width, self.size.height); break; } case UIViewContentModeBottom: { rect = CGRectMake((size.width - self.size.width) / 2.0f, size.height - self.size.height, self.size.width, self.size.height); break; } case UIViewContentModeLeft: { rect = CGRectMake(0.0f, (size.height - self.size.height) / 2.0f, self.size.width, self.size.height); break; } case UIViewContentModeRight: { rect = CGRectMake(size.width - self.size.width, (size.height - self.size.height) / 2.0f, self.size.width, self.size.height); break; } case UIViewContentModeTopLeft: { rect = CGRectMake(0.0f, 0.0f, self.size.width, self.size.height); break; } case UIViewContentModeTopRight: { rect = CGRectMake(size.width - self.size.width, 0.0f, self.size.width, self.size.height); break; } case UIViewContentModeBottomLeft: { rect = CGRectMake(0.0f, size.height - self.size.height, self.size.width, self.size.height); break; } case UIViewContentModeBottomRight: { rect = CGRectMake(size.width - self.size.width, size.height - self.size.height, self.size.width, self.size.height); break; } case UIViewContentModeRedraw: case UIViewContentModeScaleToFill: { rect = CGRectMake(0.0f, 0.0f, size.width, size.height); break; } } if (!padToFit) { //remove padding if (rect.size.width < size.width) { size.width = rect.size.width; rect.origin.x = 0.0f; } if (rect.size.height < size.height) { size.height = rect.size.height; rect.origin.y = 0.0f; } } //avoid redundant drawing if (CGSizeEqualToSize(self.size, size)) { return self; } //create drawing context UIGraphicsBeginImageContextWithOptions(size, NO, 0.0f); //draw [self drawInRect:rect]; //capture resultant image UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); //return image return image; } + (CGImageRef)gradientMask { static CGImageRef sharedMask = NULL; if (sharedMask == NULL) { //create gradient mask UIGraphicsBeginImageContextWithOptions(CGSizeMake(1, 256), YES, 0.0); CGContextRef gradientContext = UIGraphicsGetCurrentContext(); CGFloat colors[] = {0.0, 1.0, 1.0, 1.0}; CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray(); CGGradientRef gradient = CGGradientCreateWithColorComponents(colorSpace, colors, NULL, 2); CGPoint gradientStartPoint = CGPointMake(0, 0); CGPoint gradientEndPoint = CGPointMake(0, 256); CGContextDrawLinearGradient(gradientContext, gradient, gradientStartPoint, gradientEndPoint, kCGGradientDrawsAfterEndLocation); sharedMask = CGBitmapContextCreateImage(gradientContext); CGGradientRelease(gradient); CGColorSpaceRelease(colorSpace); UIGraphicsEndImageContext(); } return sharedMask; } - (UIImage *)reflectedImageWithScale:(CGFloat)scale { //get reflection dimensions CGFloat height = ceil(self.size.height * scale); CGSize size = CGSizeMake(self.size.width, height); CGRect bounds = CGRectMake(0.0f, 0.0f, size.width, size.height); //create drawing context UIGraphicsBeginImageContextWithOptions(size, NO, 0.0f); CGContextRef context = UIGraphicsGetCurrentContext(); //clip to gradient CGContextClipToMask(context, bounds, [[self class] gradientMask]); //draw reflected image CGContextScaleCTM(context, 1.0f, -1.0f); CGContextTranslateCTM(context, 0.0f, -self.size.height); [self drawInRect:CGRectMake(0.0f, 0.0f, self.size.width, self.size.height)]; //capture resultant image UIImage *reflection = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); //return reflection image return reflection; } - (UIImage *)imageWithReflectionWithScale:(CGFloat)scale gap:(CGFloat)gap alpha:(CGFloat)alpha { //get reflected image UIImage *reflection = [self reflectedImageWithScale:scale]; CGFloat reflectionOffset = reflection.size.height + gap; //create drawing context UIGraphicsBeginImageContextWithOptions(CGSizeMake(self.size.width, self.size.height + reflectionOffset * 2.0f), NO, 0.0f); //draw reflection [reflection drawAtPoint:CGPointMake(0.0f, reflectionOffset + self.size.height + gap) blendMode:kCGBlendModeNormal alpha:alpha]; //draw image [self drawAtPoint:CGPointMake(0.0f, reflectionOffset)]; //capture resultant image UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); //return image return image; } - (UIImage *)imageWithShadowColor:(UIColor *)color offset:(CGSize)offset blur:(CGFloat)blur { //get size CGSize border = CGSizeMake(fabsf(offset.width) + blur, fabsf(offset.height) + blur); CGSize size = CGSizeMake(self.size.width + border.width * 2.0f, self.size.height + border.height * 2.0f); //create drawing context UIGraphicsBeginImageContextWithOptions(size, NO, 0.0f); CGContextRef context = UIGraphicsGetCurrentContext(); //set up shadow CGContextSetShadowWithColor(context, offset, blur, color.CGColor); //draw with shadow [self drawAtPoint:CGPointMake(border.width, border.height)]; //capture resultant image UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); //return image return image; } - (UIImage *)imageWithCornerRadius:(CGFloat)radius { //create drawing context UIGraphicsBeginImageContextWithOptions(self.size, NO, 0.0f); //clip image [[UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, self.size.width, self.size.height) cornerRadius:radius] addClip]; //draw image [self drawAtPoint:CGPointZero]; //capture resultant image UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); //return image return image; } - (UIImage *)imageWithAlpha:(CGFloat)alpha { //create drawing context UIGraphicsBeginImageContextWithOptions(self.size, NO, 0.0f); //draw with alpha [self drawAtPoint:CGPointZero blendMode:kCGBlendModeNormal alpha:alpha]; //capture resultant image UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); //return image return image; } - (UIImage *)imageWithMask:(UIImage *)maskImage { //create drawing context UIGraphicsBeginImageContextWithOptions(self.size, NO, 0.0f); CGContextRef context = UIGraphicsGetCurrentContext(); //apply mask CGContextClipToMask(context, CGRectMake(0.0f, 0.0f, self.size.width, self.size.height), maskImage.CGImage); //draw image [self drawAtPoint:CGPointZero]; //capture resultant image UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); //return image return image; } - (UIImage *)maskImageFromImageAlpha { //get dimensions NSInteger width = CGImageGetWidth(self.CGImage); NSInteger height = CGImageGetHeight(self.CGImage); //create alpha image NSInteger bytesPerRow = ((width + 3) / 4) * 4; uint8_t *data = (uint8_t *)malloc(bytesPerRow * height); CGContextRef context = CGBitmapContextCreate(data, width, height, 8, bytesPerRow, NULL, (CGBitmapInfo)kCGImageAlphaOnly); CGContextDrawImage(context, CGRectMake(0.0f, 0.0f, width, height), self.CGImage); //invert alpha pixels for (NSInteger y = 0; y < height; y++) { for (NSInteger x = 0; x < width; x++) { NSInteger index = y * bytesPerRow + x; data[index] = 255 - data[index]; } } //create mask image CGImageRef maskRef = CGBitmapContextCreateImage(context); CGContextRelease(context); UIImage *mask = [UIImage imageWithCGImage:maskRef]; CGImageRelease(maskRef); free(data); //return image return mask; } @end ================================================ FILE: Examples/Libraries/ReflectionView/ReflectionView.h ================================================ // // ReflectionView.h // // Version 1.2 // // Created by Nick Lockwood on 19/07/2011. // Copyright 2011 Charcoal Design // // Distributed under the permissive zlib license // Get the latest version from here: // // https://github.com/nicklockwood/ReflectionView // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wobjc-missing-property-synthesis" #import #import @interface ReflectionView : UIView @property (nonatomic, assign) CGFloat reflectionGap; @property (nonatomic, assign) CGFloat reflectionScale; @property (nonatomic, assign) CGFloat reflectionAlpha; @property (nonatomic, assign) BOOL dynamic; - (void)update; @end #pragma GCC diagnostic pop ================================================ FILE: Examples/Libraries/ReflectionView/ReflectionView.m ================================================ // // ReflectionView.m // // Version 1.2 // // Created by Nick Lockwood on 19/07/2011. // Copyright 2011 Charcoal Design // // Distributed under the permissive zlib license // Get the latest version from here: // // https://github.com/nicklockwood/ReflectionView // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // #import "ReflectionView.h" #import #if !__has_feature(objc_arc) #error This class requires automatic reference counting #endif #pragma GCC diagnostic ignored "-Wreceiver-is-weak" #pragma GCC diagnostic ignored "-Warc-repeated-use-of-weak" #pragma GCC diagnostic ignored "-Wobjc-missing-property-synthesis" #pragma GCC diagnostic ignored "-Wdirect-ivar-access" #pragma GCC diagnostic ignored "-Wunused-macros" #pragma GCC diagnostic ignored "-Wconversion" #pragma GCC diagnostic ignored "-Wformat-nonliteral" #pragma GCC diagnostic ignored "-Wgnu" @interface ReflectionView () @property (nonatomic, strong) CAGradientLayer *gradientLayer; @property (nonatomic, strong) UIImageView *reflectionView; @end @implementation ReflectionView + (Class)layerClass { return [CAReplicatorLayer class]; } - (void)update { if (_dynamic) { //remove gradient view [_reflectionView removeFromSuperview]; self.reflectionView = nil; //update instances CAReplicatorLayer *layer = (CAReplicatorLayer *)self.layer; layer.shouldRasterize = YES; layer.rasterizationScale = [UIScreen mainScreen].scale; layer.instanceCount = 2; CATransform3D transform = CATransform3DIdentity; transform = CATransform3DTranslate(transform, 0.0f, layer.bounds.size.height + _reflectionGap, 0.0f); transform = CATransform3DScale(transform, 1.0f, -1.0f, 0.0f); layer.instanceTransform = transform; layer.instanceAlphaOffset = _reflectionAlpha - 1.0f; //create gradient layer if (!_gradientLayer) { _gradientLayer = [[CAGradientLayer alloc] init]; self.layer.mask = _gradientLayer; _gradientLayer.colors = @[(__bridge id)[UIColor blackColor].CGColor, (__bridge id)[UIColor blackColor].CGColor, (__bridge id)[UIColor clearColor].CGColor]; } //update mask [CATransaction begin]; [CATransaction setDisableActions:YES]; // don't animate CGFloat total = layer.bounds.size.height * 2.0f + _reflectionGap; CGFloat halfWay = (layer.bounds.size.height + _reflectionGap) / total - 0.01f; _gradientLayer.frame = CGRectMake(0.0f, 0.0f, self.bounds.size.width, total); _gradientLayer.locations = @[@0.0f, @(halfWay), @(halfWay + (1.0f - halfWay) * _reflectionScale)]; [CATransaction commit]; } else { //remove gradient layer self.layer.mask = nil; self.gradientLayer = nil; //update instances CAReplicatorLayer *layer = (CAReplicatorLayer *)self.layer; layer.shouldRasterize = NO; layer.instanceCount = 1; //create reflection view if (!_reflectionView) { _reflectionView = [[UIImageView alloc] initWithFrame:self.bounds]; _reflectionView.contentMode = UIViewContentModeScaleToFill; _reflectionView.userInteractionEnabled = NO; [self addSubview:_reflectionView]; } //get reflection bounds CGSize size = CGSizeMake(self.bounds.size.width, self.bounds.size.height * _reflectionScale); if (size.height > 0.0f && size.width > 0.0f) { //create gradient mask UIGraphicsBeginImageContextWithOptions(size, YES, 0.0f); CGContextRef gradientContext = UIGraphicsGetCurrentContext(); CGFloat colors[] = {1.0f, 1.0f, 0.0f, 1.0f}; CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray(); CGGradientRef gradient = CGGradientCreateWithColorComponents(colorSpace, colors, NULL, 2); CGPoint gradientStartPoint = CGPointMake(0.0f, 0.0f); CGPoint gradientEndPoint = CGPointMake(0.0f, size.height); CGContextDrawLinearGradient(gradientContext, gradient, gradientStartPoint, gradientEndPoint, kCGGradientDrawsAfterEndLocation); CGImageRef gradientMask = CGBitmapContextCreateImage(gradientContext); CGGradientRelease(gradient); CGColorSpaceRelease(colorSpace); UIGraphicsEndImageContext(); //create drawing context UIGraphicsBeginImageContextWithOptions(size, NO, 0.0f); CGContextRef context = UIGraphicsGetCurrentContext(); CGContextScaleCTM(context, 1.0f, -1.0f); CGContextTranslateCTM(context, 0.0f, -self.bounds.size.height); //clip to gradient CGContextClipToMask(context, CGRectMake(0.0f, self.bounds.size.height - size.height, size.width, size.height), gradientMask); CGImageRelease(gradientMask); //draw reflected layer content [self.layer renderInContext:context]; //capture resultant image _reflectionView.image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); } //update reflection _reflectionView.alpha = _reflectionAlpha; _reflectionView.frame = CGRectMake(0, self.bounds.size.height + _reflectionGap, size.width, size.height); } } - (void)setUp { //set default properties _reflectionGap = 4.0f; _reflectionScale = 0.5f; _reflectionAlpha = 0.5f; //update reflection [self setNeedsLayout]; } - (id)initWithCoder:(NSCoder *)aDecoder { if ((self = [super initWithCoder:aDecoder])) { [self setUp]; } return self; } - (id)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { [self setUp]; } return self; } - (void)setReflectionGap:(CGFloat)reflectionGap { _reflectionGap = reflectionGap; [self setNeedsLayout]; } - (void)setReflectionScale:(CGFloat)reflectionScale { _reflectionScale = reflectionScale; [self setNeedsLayout]; } - (void)setReflectionAlpha:(CGFloat)reflectionAlpha { _reflectionAlpha = reflectionAlpha; [self setNeedsLayout]; } - (void)setDynamic:(BOOL)dynamic { _dynamic = dynamic; [self setNeedsLayout]; } - (void)layoutSubviews { [self update]; [super layoutSubviews]; } @end ================================================ FILE: Examples/Mac Demo/iCarouselMac/en.lproj/Credits.rtf ================================================ {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} {\colortbl;\red255\green255\blue255;} \paperw9840\paperh8400 \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural \f0\b\fs24 \cf0 Engineering: \b0 \ Some people\ \ \b Human Interface Design: \b0 \ Some other people\ \ \b Testing: \b0 \ Hopefully not nobody\ \ \b Documentation: \b0 \ Whoever\ \ \b With special thanks to: \b0 \ Mom\ } ================================================ FILE: Examples/Mac Demo/iCarouselMac/en.lproj/InfoPlist.strings ================================================ /* Localized versions of Info.plist keys */ ================================================ FILE: Examples/Mac Demo/iCarouselMac/en.lproj/MainMenu.xib ================================================ 1070 11C74 1938 1138.23 567.00 com.apple.InterfaceBuilder.CocoaPlugin 1938 YES NSView NSMenu NSWindowTemplate NSMenuItem NSTextField NSTextFieldCell NSImageCell NSImageView NSCustomObject YES com.apple.InterfaceBuilder.CocoaPlugin PluginDependencyRecalculationVersion YES NSApplication FirstResponder NSApplication AMainMenu YES iCarouselMac 1048576 2147483647 NSImage NSMenuCheckmark NSImage NSMenuMixedState submenuAction: iCarouselMac YES About iCarouselMac 2147483647 YES YES 1048576 2147483647 Preferences… , 1048576 2147483647 YES YES 1048576 2147483647 Services 1048576 2147483647 submenuAction: Services YES _NSServicesMenu YES YES 1048576 2147483647 Hide iCarouselMac h 1048576 2147483647 Hide Others h 1572864 2147483647 Show All 1048576 2147483647 YES YES 1048576 2147483647 Quit iCarouselMac q 1048576 2147483647 _NSAppleMenu File 1048576 2147483647 submenuAction: File YES New n 1048576 2147483647 Open… o 1048576 2147483647 Open Recent 1048576 2147483647 submenuAction: Open Recent YES Clear Menu 1048576 2147483647 _NSRecentDocumentsMenu YES YES 1048576 2147483647 Close w 1048576 2147483647 Save s 1048576 2147483647 Save As… S 1179648 2147483647 Revert to Saved 2147483647 YES YES 1048576 2147483647 Page Setup... P 1179648 2147483647 Print… p 1048576 2147483647 Edit 1048576 2147483647 submenuAction: Edit YES Undo z 1048576 2147483647 Redo Z 1179648 2147483647 YES YES 1048576 2147483647 Cut x 1048576 2147483647 Copy c 1048576 2147483647 Paste v 1048576 2147483647 Paste and Match Style V 1572864 2147483647 Delete 1048576 2147483647 Select All a 1048576 2147483647 YES YES 1048576 2147483647 Find 1048576 2147483647 submenuAction: Find YES Find… f 1048576 2147483647 1 Find Next g 1048576 2147483647 2 Find Previous G 1179648 2147483647 3 Use Selection for Find e 1048576 2147483647 7 Jump to Selection j 1048576 2147483647 Spelling and Grammar 1048576 2147483647 submenuAction: Spelling and Grammar YES Show Spelling and Grammar : 1048576 2147483647 Check Document Now ; 1048576 2147483647 YES YES 2147483647 Check Spelling While Typing 1048576 2147483647 Check Grammar With Spelling 1048576 2147483647 Correct Spelling Automatically 2147483647 Substitutions 1048576 2147483647 submenuAction: Substitutions YES Show Substitutions 2147483647 YES YES 2147483647 Smart Copy/Paste f 1048576 2147483647 1 Smart Quotes g 1048576 2147483647 2 Smart Dashes 2147483647 Smart Links G 1179648 2147483647 3 Text Replacement 2147483647 Transformations 2147483647 submenuAction: Transformations YES Make Upper Case 2147483647 Make Lower Case 2147483647 Capitalize 2147483647 Speech 1048576 2147483647 submenuAction: Speech YES Start Speaking 1048576 2147483647 Stop Speaking 1048576 2147483647 Format 2147483647 submenuAction: Format YES Font 2147483647 submenuAction: Font YES Show Fonts t 1048576 2147483647 Bold b 1048576 2147483647 2 Italic i 1048576 2147483647 1 Underline u 1048576 2147483647 YES YES 2147483647 Bigger + 1048576 2147483647 3 Smaller - 1048576 2147483647 4 YES YES 2147483647 Kern 2147483647 submenuAction: Kern YES Use Default 2147483647 Use None 2147483647 Tighten 2147483647 Loosen 2147483647 Ligature 2147483647 submenuAction: Ligature YES Use Default 2147483647 Use None 2147483647 Use All 2147483647 Baseline 2147483647 submenuAction: Baseline YES Use Default 2147483647 Superscript 2147483647 Subscript 2147483647 Raise 2147483647 Lower 2147483647 YES YES 2147483647 Show Colors C 1048576 2147483647 YES YES 2147483647 Copy Style c 1572864 2147483647 Paste Style v 1572864 2147483647 _NSFontMenu Text 2147483647 submenuAction: Text YES Align Left { 1048576 2147483647 Center | 1048576 2147483647 Justify 2147483647 Align Right } 1048576 2147483647 YES YES 2147483647 Writing Direction 2147483647 submenuAction: Writing Direction YES YES Paragraph 2147483647 CURlZmF1bHQ 2147483647 CUxlZnQgdG8gUmlnaHQ 2147483647 CVJpZ2h0IHRvIExlZnQ 2147483647 YES YES 2147483647 YES Selection 2147483647 CURlZmF1bHQ 2147483647 CUxlZnQgdG8gUmlnaHQ 2147483647 CVJpZ2h0IHRvIExlZnQ 2147483647 YES YES 2147483647 Show Ruler 2147483647 Copy Ruler c 1310720 2147483647 Paste Ruler v 1310720 2147483647 View 1048576 2147483647 submenuAction: View YES Show Toolbar t 1572864 2147483647 Customize Toolbar… 1048576 2147483647 YES YES 2147483647 Linear 1 1048576 2147483647 YES Rotary 2 1048576 2147483647 1 YES Inverted Rotary 3 1048576 2147483647 2 YES Cylinder 4 1048576 2147483647 3 YES Inverted Cylinder 5 1048576 2147483647 4 YES Wheel 6 1048576 2147483647 5 YES Inverted Wheel 7 1048576 2147483647 6 YES CoverFlow 8 1048576 2147483647 7 YES CoverFlow2 9 1048576 2147483647 8 YES Time Machine 0 1048576 2147483647 9 YES Inverted Time Machine r 1048576 2147483647 10 YES Custom t 1048576 2147483647 11 YES YES 2147483647 YES Insert Item 2147483647 Remove Item 2147483647 YES YES 2147483647 Vertical 2147483647 Wrap 2147483647 1 Window 1048576 2147483647 submenuAction: Window YES Minimize m 1048576 2147483647 Zoom 1048576 2147483647 YES YES 1048576 2147483647 Bring All to Front 1048576 2147483647 _NSWindowsMenu Help 2147483647 submenuAction: Help YES iCarouselMac Help ? 1048576 2147483647 _NSHelpMenu _NSMainMenu 15 2 {{335, 390}, {480, 360}} 1954021376 iCarouselMac NSWindow 256 YES 274 YES YES Apple PDF pasteboard type Apple PICT pasteboard type Apple PNG pasteboard type NSFilenamesPboardType NeXT Encapsulated PostScript v1.2 pasteboard type NeXT TIFF v4.0 pasteboard type {480, 360} 2 YES 130560 33554432 NSImage background 0 1 0 YES YES 269 {{130, 323}, {220, 17}} YES 68288064 138413056 Check View menu for options LucidaGrande 13 1044 6 System controlColor 3 MC42NjY2NjY2NjY3AA 6 System controlTextColor 3 MAA 274 {480, 360} 2 {480, 360} 2 {{0, 0}, {1920, 1178}} {10000000000000, 10000000000000} YES iCarouselMacAppDelegate NSFontManager iCarouselWindowController YES terminate: 449 orderFrontStandardAboutPanel: 142 delegate 495 performMiniaturize: 37 arrangeInFront: 39 print: 86 runPageLayout: 87 clearRecentDocuments: 127 performClose: 193 toggleContinuousSpellChecking: 222 undo: 223 copy: 224 checkSpelling: 225 paste: 226 stopSpeaking: 227 cut: 228 showGuessPanel: 230 redo: 231 selectAll: 232 startSpeaking: 233 delete: 235 performZoom: 240 performFindPanelAction: 241 centerSelectionInVisibleArea: 245 toggleGrammarChecking: 347 toggleSmartInsertDelete: 355 toggleAutomaticQuoteSubstitution: 356 toggleAutomaticLinkDetection: 357 saveDocument: 362 saveDocumentAs: 363 revertDocumentToSaved: 364 runToolbarCustomizationPalette: 365 toggleToolbarShown: 366 hide: 367 hideOtherApplications: 368 unhideAllApplications: 370 newDocument: 373 openDocument: 374 raiseBaseline: 426 lowerBaseline: 427 copyFont: 428 subscript: 429 superscript: 430 tightenKerning: 431 underline: 432 orderFrontColorPanel: 433 useAllLigatures: 434 loosenKerning: 435 pasteFont: 436 unscript: 437 useStandardKerning: 438 useStandardLigatures: 439 turnOffLigatures: 440 turnOffKerning: 441 toggleAutomaticSpellingCorrection: 456 orderFrontSubstitutionsPanel: 458 toggleAutomaticDashSubstitution: 461 toggleAutomaticTextReplacement: 463 uppercaseWord: 464 capitalizeWord: 467 lowercaseWord: 468 pasteAsPlainText: 486 performFindPanelAction: 487 performFindPanelAction: 488 performFindPanelAction: 489 showHelp: 493 alignCenter: 518 pasteRuler: 519 toggleRuler: 520 alignRight: 521 copyRuler: 522 alignJustified: 523 alignLeft: 524 makeBaseWritingDirectionNatural: 525 makeBaseWritingDirectionLeftToRight: 526 makeBaseWritingDirectionRightToLeft: 527 makeTextWritingDirectionNatural: 528 makeTextWritingDirectionLeftToRight: 529 makeTextWritingDirectionRightToLeft: 530 addFontTrait: 421 addFontTrait: 422 modifyFont: 423 orderFrontFontPanel: 424 modifyFont: 425 window 532 windowController 543 window 544 carousel 550 switchCarouselType: 553 switchCarouselType: 554 switchCarouselType: 555 switchCarouselType: 556 switchCarouselType: 557 switchCarouselType: 558 switchCarouselType: 559 toggleWrap: 564 switchCarouselType: 568 insertItem: 574 removeItem: 575 switchCarouselType: 579 switchCarouselType: 581 switchCarouselType: 583 toggleVertical: 588 switchCarouselType: 590 dataSource 551 delegate 552 YES 0 YES -2 File's Owner -1 First Responder -3 Application 29 YES 19 YES 56 YES 217 YES 83 YES 81 YES 75 80 78 72 82 124 YES 77 73 79 112 74 125 YES 126 205 YES 202 198 207 214 199 203 197 206 215 218 YES 216 YES 200 YES 219 201 204 220 YES 213 210 221 208 209 57 YES 58 134 150 136 144 129 143 236 131 YES 149 145 130 24 YES 92 5 239 23 295 YES 296 YES 297 298 211 YES 212 YES 195 196 346 348 YES 349 YES 350 351 354 371 YES 372 YES 375 YES 376 YES 377 YES 388 YES 389 390 391 392 393 394 395 396 397 YES 398 YES 399 YES 400 401 402 403 404 405 YES 406 407 408 409 410 411 YES 412 413 414 415 YES 416 417 418 419 420 450 YES 451 YES 452 453 454 457 459 460 462 465 466 485 490 YES 491 YES 492 494 496 YES 497 YES 498 499 500 501 502 503 YES 504 505 506 507 508 YES 509 510 511 512 513 514 515 516 517 534 535 536 537 538 539 540 541 542 Window Controller 545 YES 546 547 YES 560 561 567 569 571 572 578 580 582 587 576 YES 577 589 YES YES -1.IBPluginDependency -2.IBPluginDependency -3.IBPluginDependency 112.IBPluginDependency 124.IBPluginDependency 125.IBPluginDependency 126.IBPluginDependency 129.IBPluginDependency 130.IBPluginDependency 131.IBPluginDependency 134.IBPluginDependency 136.IBPluginDependency 143.IBPluginDependency 144.IBPluginDependency 145.IBPluginDependency 149.IBPluginDependency 150.IBPluginDependency 19.IBPluginDependency 195.IBPluginDependency 196.IBPluginDependency 197.IBPluginDependency 198.IBPluginDependency 199.IBPluginDependency 200.IBPluginDependency 201.IBPluginDependency 202.IBPluginDependency 203.IBPluginDependency 204.IBPluginDependency 205.IBPluginDependency 206.IBPluginDependency 207.IBPluginDependency 208.IBPluginDependency 209.IBPluginDependency 210.IBPluginDependency 211.IBPluginDependency 212.IBPluginDependency 213.IBPluginDependency 214.IBPluginDependency 215.IBPluginDependency 216.IBPluginDependency 217.IBPluginDependency 218.IBPluginDependency 219.IBPluginDependency 220.IBPluginDependency 221.IBPluginDependency 23.IBPluginDependency 236.IBPluginDependency 239.IBPluginDependency 24.IBPluginDependency 29.IBPluginDependency 295.IBPluginDependency 296.IBPluginDependency 297.IBPluginDependency 298.IBPluginDependency 346.IBPluginDependency 348.IBPluginDependency 349.IBPluginDependency 350.IBPluginDependency 351.IBPluginDependency 354.IBPluginDependency 371.IBPluginDependency 371.IBWindowTemplateEditedContentRect 371.NSWindowTemplate.visibleAtLaunch 372.IBPluginDependency 375.IBPluginDependency 376.IBPluginDependency 377.IBPluginDependency 388.IBPluginDependency 389.IBPluginDependency 390.IBPluginDependency 391.IBPluginDependency 392.IBPluginDependency 393.IBPluginDependency 394.IBPluginDependency 395.IBPluginDependency 396.IBPluginDependency 397.IBPluginDependency 398.IBPluginDependency 399.IBPluginDependency 400.IBPluginDependency 401.IBPluginDependency 402.IBPluginDependency 403.IBPluginDependency 404.IBPluginDependency 405.IBPluginDependency 406.IBPluginDependency 407.IBPluginDependency 408.IBPluginDependency 409.IBPluginDependency 410.IBPluginDependency 411.IBPluginDependency 412.IBPluginDependency 413.IBPluginDependency 414.IBPluginDependency 415.IBPluginDependency 416.IBPluginDependency 417.IBPluginDependency 418.IBPluginDependency 419.IBPluginDependency 420.IBPluginDependency 450.IBPluginDependency 451.IBPluginDependency 452.IBPluginDependency 453.IBPluginDependency 454.IBPluginDependency 457.IBPluginDependency 459.IBPluginDependency 460.IBPluginDependency 462.IBPluginDependency 465.IBPluginDependency 466.IBPluginDependency 485.IBPluginDependency 490.IBPluginDependency 491.IBPluginDependency 492.IBPluginDependency 494.IBPluginDependency 496.IBPluginDependency 497.IBPluginDependency 498.IBPluginDependency 499.IBPluginDependency 5.IBPluginDependency 500.IBPluginDependency 501.IBPluginDependency 502.IBPluginDependency 503.IBPluginDependency 504.IBPluginDependency 505.IBPluginDependency 506.IBPluginDependency 507.IBPluginDependency 508.IBPluginDependency 509.IBPluginDependency 510.IBPluginDependency 511.IBPluginDependency 512.IBPluginDependency 513.IBPluginDependency 514.IBPluginDependency 515.IBPluginDependency 516.IBPluginDependency 517.IBPluginDependency 534.IBPluginDependency 535.IBPluginDependency 536.IBPluginDependency 537.IBPluginDependency 538.IBPluginDependency 539.IBPluginDependency 540.IBPluginDependency 541.IBPluginDependency 542.IBPluginDependency 545.IBPluginDependency 546.IBPluginDependency 547.CustomClassName 547.IBPluginDependency 56.IBPluginDependency 560.IBPluginDependency 561.IBPluginDependency 567.IBPluginDependency 569.IBPluginDependency 57.IBPluginDependency 571.IBPluginDependency 572.IBPluginDependency 576.IBPluginDependency 577.IBPluginDependency 578.IBPluginDependency 58.IBPluginDependency 580.IBPluginDependency 582.IBPluginDependency 587.IBPluginDependency 589.IBPluginDependency 72.IBPluginDependency 73.IBPluginDependency 74.IBPluginDependency 75.IBPluginDependency 77.IBPluginDependency 78.IBPluginDependency 79.IBPluginDependency 80.IBPluginDependency 81.IBPluginDependency 82.IBPluginDependency 83.IBPluginDependency 92.IBPluginDependency YES com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin {{380, 496}, {480, 360}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin iCarousel com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin YES YES 590 YES NSDocument YES YES printDocument: revertDocumentToSaved: runPageLayout: saveDocument: saveDocumentAs: saveDocumentTo: YES id id id id id id YES YES printDocument: revertDocumentToSaved: runPageLayout: saveDocument: saveDocumentAs: saveDocumentTo: YES printDocument: id revertDocumentToSaved: id runPageLayout: id saveDocument: id saveDocumentAs: id saveDocumentTo: id IBProjectSource ./Classes/NSDocument.h iCarousel UIView YES YES dataSource delegate YES id id YES YES dataSource delegate YES dataSource id delegate id IBProjectSource ./Classes/iCarousel.h iCarouselMacAppDelegate NSObject YES YES window windowController YES NSWindow NSWindowController YES YES window windowController YES window NSWindow windowController NSWindowController IBProjectSource ./Classes/iCarouselMacAppDelegate.h iCarouselWindowController NSWindowController YES YES insertItem: removeItem: switchCarouselType: toggleVertical: toggleWrap: YES id id id id id YES YES insertItem: removeItem: switchCarouselType: toggleVertical: toggleWrap: YES insertItem: id removeItem: id switchCarouselType: id toggleVertical: id toggleWrap: id carousel iCarousel carousel carousel iCarousel IBProjectSource ./Classes/iCarouselWindowController.h 0 IBCocoaFramework com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 YES 3 YES YES NSMenuCheckmark NSMenuMixedState background YES {9, 8} {7, 2} {50, 468} ================================================ FILE: Examples/Mac Demo/iCarouselMac/iCarouselMac-Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIconFile CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1 LSMinimumSystemVersion ${MACOSX_DEPLOYMENT_TARGET} NSMainNibFile MainMenu NSPrincipalClass NSApplication ================================================ FILE: Examples/Mac Demo/iCarouselMac/iCarouselMac-Prefix.pch ================================================ // // Prefix header for all source files of the 'iCarouselMac' target in the 'iCarouselMac' project // #ifdef __OBJC__ #import #endif ================================================ FILE: Examples/Mac Demo/iCarouselMac/iCarouselMacAppDelegate.h ================================================ // // iCarouselMacAppDelegate.h // iCarouselMac // // Created by Nick Lockwood on 11/06/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import @interface iCarouselMacAppDelegate : NSObject @property (nonatomic, strong) IBOutlet NSWindow *window; @property (nonatomic, strong) IBOutlet NSWindowController *windowController; @end ================================================ FILE: Examples/Mac Demo/iCarouselMac/iCarouselMacAppDelegate.m ================================================ // // iCarouselMacAppDelegate.m // iCarouselMac // // Created by Nick Lockwood on 11/06/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselMacAppDelegate.h" @implementation iCarouselMacAppDelegate @synthesize window; @synthesize windowController; - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(__unused NSApplication *)sender { return YES; } @end ================================================ FILE: Examples/Mac Demo/iCarouselMac/iCarouselWindowController.h ================================================ // // iCarouselWindowController.h // iCarouselMac // // Created by Nick Lockwood on 11/06/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import #import "iCarousel.h" @interface iCarouselWindowController : NSWindowController @property (nonatomic, strong) IBOutlet iCarousel *carousel; - (IBAction)switchCarouselType:(id)sender; - (IBAction)toggleVertical:(id)sender; - (IBAction)toggleWrap:(id)sender; - (IBAction)insertItem:(id)sender; - (IBAction)removeItem:(id)sender; @end ================================================ FILE: Examples/Mac Demo/iCarouselMac/iCarouselWindowController.m ================================================ // // iCarouselWindowController.m // iCarouselMac // // Created by Nick Lockwood on 11/06/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselWindowController.h" @interface iCarouselWindowController () @property (nonatomic, assign) BOOL wrap; @property (nonatomic, strong) NSMutableArray *items; @end @implementation iCarouselWindowController @synthesize carousel; @synthesize wrap; @synthesize items; - (id)initWithWindow:(NSWindow *)window { if ((self = [super initWithWindow:window])) { //set up data wrap = YES; self.items = [NSMutableArray array]; for (int i = 0; i < 1000; i++) { [items addObject:[NSNumber numberWithInt:i]]; } } return self; } - (void)awakeFromNib { //configure carousel self.carousel.type = iCarouselTypeCoverFlow2; [self.window makeFirstResponder:self.carousel]; } - (void)dealloc { //it's a good idea to set these to nil here to avoid //sending messages to a deallocated window or view controller carousel.delegate = nil; carousel.dataSource = nil; } - (IBAction)switchCarouselType:(id)sender { //restore view opacities to normal for (NSView *view in self.carousel.visibleItemViews) { view.layer.opacity = 1.0; } self.carousel.type = (iCarouselType)[sender tag]; } - (IBAction)toggleVertical:(id)sender { self.carousel.vertical = !self.carousel.vertical; [(NSMenuItem *)sender setState:self.carousel.vertical? NSOnState: NSOffState]; } - (IBAction)toggleWrap:(id)sender { self.wrap = !self.wrap; [(NSMenuItem *)sender setState:self.wrap? NSOnState: NSOffState]; [self.carousel reloadData]; } - (IBAction)insertItem:(__unused id)sender { [self.carousel insertItemAtIndex:self.carousel.currentItemIndex animated:YES]; } - (IBAction)removeItem:(__unused id)sender { [self.carousel removeItemAtIndex:self.carousel.currentItemIndex animated:YES]; } #pragma mark - #pragma mark iCarousel methods - (NSInteger)numberOfItemsInCarousel:(__unused iCarousel *)carousel { return (NSInteger)[self.items count]; } - (NSView *)carousel:(__unused iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(NSView *)view { NSTextField *label = nil; //create new view if no view is available for recycling if (view == nil) { //don't do anything specific to the index within //this `if (view == nil) {...}` statement because the view will be //recycled and used with other index values later NSImage *image = [NSImage imageNamed:@"page.png"]; view = [[NSImageView alloc] initWithFrame:NSMakeRect(0,0,image.size.width,image.size.height)]; [(NSImageView *)view setImage:image]; [(NSImageView *)view setImageScaling:NSImageScaleAxesIndependently]; label = [[NSTextField alloc] init]; [label setBackgroundColor:[NSColor clearColor]]; [label setBordered:NO]; [label setSelectable:NO]; [label setAlignment:NSCenterTextAlignment]; [label setFont:[NSFont fontWithName:[(NSFont * __nonnull)[label font] fontName] size:50]]; label.tag = 1; [view addSubview:label]; } else { //get a reference to the label in the recycled view label = (NSTextField *)[view viewWithTag:1]; } //set item label //remember to always set any properties of your carousel item //views outside of the `if (view == nil) {...}` check otherwise //you'll get weird issues with carousel item content appearing //in the wrong place in the carousel [label setStringValue:[NSString stringWithFormat:@"%lu", index]]; [label sizeToFit]; [label setFrameOrigin:NSMakePoint((view.bounds.size.width - label.frame.size.width)/2.0, (view.bounds.size.height - label.frame.size.height)/2.0)]; return view; } - (NSInteger)numberOfPlaceholdersInCarousel:(__unused iCarousel *)carousel { //note: placeholder views are only displayed if wrapping is disabled return 2; } - (NSView *)carousel:(__unused iCarousel *)carousel placeholderViewAtIndex:(NSInteger)index reusingView:(NSView *)view { NSTextField *label = nil; //create new view if no view is available for recycling if (view == nil) { NSImage *image = [NSImage imageNamed:@"page.png"]; view = [[NSImageView alloc] initWithFrame:NSMakeRect(0,0,image.size.width,image.size.height)]; [(NSImageView *)view setImage:image]; [(NSImageView *)view setImageScaling:NSImageScaleAxesIndependently]; label = [[NSTextField alloc] init]; [label setBackgroundColor:[NSColor clearColor]]; [label setBordered:NO]; [label setSelectable:NO]; [label setAlignment:NSCenterTextAlignment]; [label setFont:[NSFont fontWithName:[(NSFont * __nonnull)[label font] fontName] size:50]]; label.tag = 1; [view addSubview:label]; } else { //get a reference to the label in the recycled view label = (NSTextField *)[view viewWithTag:1]; } //set item label //remember to always set any properties of your carousel item //views outside of the `if (view == nil) {...}` check otherwise //you'll get weird issues with carousel item content appearing //in the wrong place in the carousel [label setStringValue:(index == 0)? @"[": @"]"]; [label sizeToFit]; [label setFrameOrigin:NSMakePoint((view.bounds.size.width - label.frame.size.width)/2.0, (view.bounds.size.height - label.frame.size.height)/2.0)]; return view; } - (CGFloat)carouselItemWidth:(__unused iCarousel *)carousel { //set correct view size //because the background image on the views makes them too large return 200.0; } - (CATransform3D)carousel:(__unused iCarousel *)_carousel itemTransformForOffset:(CGFloat)offset baseTransform:(CATransform3D)transform { //implement 'flip3D' style carousel transform = CATransform3DRotate(transform, M_PI / 8.0, 0.0, 1.0, 0.0); return CATransform3DTranslate(transform, 0.0, 0.0, offset * self.carousel.itemWidth); } - (CGFloat)carousel:(__unused iCarousel *)_carousel valueForOption:(iCarouselOption)option withDefault:(CGFloat)value { //customize carousel display switch (option) { case iCarouselOptionWrap: { //normally you would hard-code this to YES or NO return self.wrap; } case iCarouselOptionSpacing: { //reduce item spacing to compensate //for drop shadow and reflection around views return value * 1.05; } case iCarouselOptionFadeMax: { if (self.carousel.type == iCarouselTypeCustom) { //set opacity based on distance from camera return 0.0; } return value; } case iCarouselOptionShowBackfaces: case iCarouselOptionRadius: case iCarouselOptionAngle: case iCarouselOptionArc: case iCarouselOptionTilt: case iCarouselOptionCount: case iCarouselOptionFadeMin: case iCarouselOptionFadeMinAlpha: case iCarouselOptionFadeRange: case iCarouselOptionOffsetMultiplier: case iCarouselOptionVisibleItems: { return value; } } } @end ================================================ FILE: Examples/Mac Demo/iCarouselMac/main.m ================================================ // // main.m // iCarouselMac // // Created by Nick Lockwood on 11/06/2011. // Copyright 2011 __MyCompanyName__. All rights reserved. // #import int main(int argc, const char *argv[]) { return NSApplicationMain(argc, argv); } ================================================ FILE: Examples/Mac Demo/iCarouselMac.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 0134186213A4030B0030BB65 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0134186113A4030B0030BB65 /* QuartzCore.framework */; }; 018BBC6913A37041005CA505 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 018BBC6813A37041005CA505 /* Cocoa.framework */; }; 018BBC7313A37041005CA505 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 018BBC7113A37041005CA505 /* InfoPlist.strings */; }; 018BBC7613A37041005CA505 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 018BBC7513A37041005CA505 /* main.m */; }; 018BBC7913A37041005CA505 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 018BBC7713A37041005CA505 /* Credits.rtf */; }; 018BBC7C13A37041005CA505 /* iCarouselMacAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 018BBC7B13A37041005CA505 /* iCarouselMacAppDelegate.m */; }; 018BBC9E13A37314005CA505 /* iCarouselWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 018BBC9D13A37314005CA505 /* iCarouselWindowController.m */; }; B2E5E6F3146151F900EADB7A /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = B2E5E6F1146151F900EADB7A /* MainMenu.xib */; }; B2E5E6FC1461524900EADB7A /* iCarousel.m in Sources */ = {isa = PBXBuildFile; fileRef = B2E5E6FB1461524900EADB7A /* iCarousel.m */; }; B2E5E7001461526300EADB7A /* background.png in Resources */ = {isa = PBXBuildFile; fileRef = B2E5E6FE1461526300EADB7A /* background.png */; }; B2E5E7011461526300EADB7A /* page.png in Resources */ = {isa = PBXBuildFile; fileRef = B2E5E6FF1461526300EADB7A /* page.png */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 0134186113A4030B0030BB65 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 018BBC6413A37041005CA505 /* iCarouselMac.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iCarouselMac.app; sourceTree = BUILT_PRODUCTS_DIR; }; 018BBC6813A37041005CA505 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; 018BBC6B13A37041005CA505 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; 018BBC6C13A37041005CA505 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; 018BBC6D13A37041005CA505 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 018BBC7013A37041005CA505 /* iCarouselMac-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "iCarouselMac-Info.plist"; sourceTree = ""; }; 018BBC7213A37041005CA505 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 018BBC7413A37041005CA505 /* iCarouselMac-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "iCarouselMac-Prefix.pch"; sourceTree = ""; }; 018BBC7513A37041005CA505 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 018BBC7813A37041005CA505 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/Credits.rtf; sourceTree = ""; }; 018BBC7A13A37041005CA505 /* iCarouselMacAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = iCarouselMacAppDelegate.h; sourceTree = ""; }; 018BBC7B13A37041005CA505 /* iCarouselMacAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = iCarouselMacAppDelegate.m; sourceTree = ""; }; 018BBC9C13A37314005CA505 /* iCarouselWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselWindowController.h; sourceTree = ""; }; 018BBC9D13A37314005CA505 /* iCarouselWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselWindowController.m; sourceTree = ""; }; B2E5E6F2146151F900EADB7A /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = ""; }; B2E5E6FA1461524900EADB7A /* iCarousel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarousel.h; sourceTree = ""; }; B2E5E6FB1461524900EADB7A /* iCarousel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarousel.m; sourceTree = ""; }; B2E5E6FE1461526300EADB7A /* background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = background.png; sourceTree = ""; }; B2E5E6FF1461526300EADB7A /* page.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = page.png; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 018BBC6113A37041005CA505 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 0134186213A4030B0030BB65 /* QuartzCore.framework in Frameworks */, 018BBC6913A37041005CA505 /* Cocoa.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 018BBC5913A37041005CA505 = { isa = PBXGroup; children = ( B2E5E6F91461524800EADB7A /* iCarousel */, 018BBC6E13A37041005CA505 /* iCarouselMac */, 018BBC6713A37041005CA505 /* Frameworks */, 018BBC6513A37041005CA505 /* Products */, ); sourceTree = ""; }; 018BBC6513A37041005CA505 /* Products */ = { isa = PBXGroup; children = ( 018BBC6413A37041005CA505 /* iCarouselMac.app */, ); name = Products; sourceTree = ""; }; 018BBC6713A37041005CA505 /* Frameworks */ = { isa = PBXGroup; children = ( 0134186113A4030B0030BB65 /* QuartzCore.framework */, 018BBC6813A37041005CA505 /* Cocoa.framework */, 018BBC6A13A37041005CA505 /* Other Frameworks */, ); name = Frameworks; sourceTree = ""; }; 018BBC6A13A37041005CA505 /* Other Frameworks */ = { isa = PBXGroup; children = ( 018BBC6B13A37041005CA505 /* AppKit.framework */, 018BBC6C13A37041005CA505 /* CoreData.framework */, 018BBC6D13A37041005CA505 /* Foundation.framework */, ); name = "Other Frameworks"; sourceTree = ""; }; 018BBC6E13A37041005CA505 /* iCarouselMac */ = { isa = PBXGroup; children = ( 018BBC7A13A37041005CA505 /* iCarouselMacAppDelegate.h */, 018BBC7B13A37041005CA505 /* iCarouselMacAppDelegate.m */, 018BBC9C13A37314005CA505 /* iCarouselWindowController.h */, 018BBC9D13A37314005CA505 /* iCarouselWindowController.m */, B2E5E6F1146151F900EADB7A /* MainMenu.xib */, B2E5E6FD1461526300EADB7A /* Resources */, 018BBC6F13A37041005CA505 /* Supporting Files */, ); path = iCarouselMac; sourceTree = ""; }; 018BBC6F13A37041005CA505 /* Supporting Files */ = { isa = PBXGroup; children = ( 018BBC7013A37041005CA505 /* iCarouselMac-Info.plist */, 018BBC7113A37041005CA505 /* InfoPlist.strings */, 018BBC7413A37041005CA505 /* iCarouselMac-Prefix.pch */, 018BBC7513A37041005CA505 /* main.m */, 018BBC7713A37041005CA505 /* Credits.rtf */, ); name = "Supporting Files"; sourceTree = ""; }; B2E5E6F91461524800EADB7A /* iCarousel */ = { isa = PBXGroup; children = ( B2E5E6FA1461524900EADB7A /* iCarousel.h */, B2E5E6FB1461524900EADB7A /* iCarousel.m */, ); name = iCarousel; path = ../../iCarousel; sourceTree = ""; }; B2E5E6FD1461526300EADB7A /* Resources */ = { isa = PBXGroup; children = ( B2E5E6FE1461526300EADB7A /* background.png */, B2E5E6FF1461526300EADB7A /* page.png */, ); name = Resources; path = ../../Resources; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 018BBC6313A37041005CA505 /* iCarouselMac */ = { isa = PBXNativeTarget; buildConfigurationList = 018BBC8213A37041005CA505 /* Build configuration list for PBXNativeTarget "iCarouselMac" */; buildPhases = ( 018BBC6013A37041005CA505 /* Sources */, 018BBC6113A37041005CA505 /* Frameworks */, 018BBC6213A37041005CA505 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = iCarouselMac; productName = iCarouselMac; productReference = 018BBC6413A37041005CA505 /* iCarouselMac.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 018BBC5B13A37041005CA505 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0800; }; buildConfigurationList = 018BBC5E13A37041005CA505 /* Build configuration list for PBXProject "iCarouselMac" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); mainGroup = 018BBC5913A37041005CA505; productRefGroup = 018BBC6513A37041005CA505 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 018BBC6313A37041005CA505 /* iCarouselMac */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 018BBC6213A37041005CA505 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 018BBC7313A37041005CA505 /* InfoPlist.strings in Resources */, 018BBC7913A37041005CA505 /* Credits.rtf in Resources */, B2E5E6F3146151F900EADB7A /* MainMenu.xib in Resources */, B2E5E7001461526300EADB7A /* background.png in Resources */, B2E5E7011461526300EADB7A /* page.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 018BBC6013A37041005CA505 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 018BBC7613A37041005CA505 /* main.m in Sources */, 018BBC7C13A37041005CA505 /* iCarouselMacAppDelegate.m in Sources */, 018BBC9E13A37314005CA505 /* iCarouselWindowController.m in Sources */, B2E5E6FC1461524900EADB7A /* iCarousel.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 018BBC7113A37041005CA505 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( 018BBC7213A37041005CA505 /* en */, ); name = InfoPlist.strings; sourceTree = ""; }; 018BBC7713A37041005CA505 /* Credits.rtf */ = { isa = PBXVariantGroup; children = ( 018BBC7813A37041005CA505 /* en */, ); name = Credits.rtf; sourceTree = ""; }; B2E5E6F1146151F900EADB7A /* MainMenu.xib */ = { isa = PBXVariantGroup; children = ( B2E5E6F2146151F900EADB7A /* en */, ); name = MainMenu.xib; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 018BBC8013A37041005CA505 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_CXX0X_EXTENSIONS = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = YES; CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES; CLANG_WARN_OBJC_RECEIVER_WEAK = YES; CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES; CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__EXIT_TIME_DESTRUCTORS = YES; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = DEBUG; GCC_SHORT_ENUMS = YES; GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES; GCC_TREAT_WARNINGS_AS_ERRORS = YES; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES; GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES; GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; GCC_WARN_PEDANTIC = YES; GCC_WARN_SHADOW = YES; GCC_WARN_SIGN_COMPARE = YES; GCC_WARN_STRICT_SELECTOR_MATCH = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNKNOWN_PRAGMAS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_LABEL = YES; GCC_WARN_UNUSED_PARAMETER = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.7; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; VALID_ARCHS = x86_64; WARNING_CFLAGS = "-Weverything"; }; name = Debug; }; 018BBC8113A37041005CA505 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_CXX0X_EXTENSIONS = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = YES; CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES; CLANG_WARN_OBJC_RECEIVER_WEAK = YES; CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES; CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__EXIT_TIME_DESTRUCTORS = YES; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_SHORT_ENUMS = YES; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES; GCC_TREAT_WARNINGS_AS_ERRORS = YES; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES; GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES; GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; GCC_WARN_PEDANTIC = YES; GCC_WARN_SHADOW = YES; GCC_WARN_SIGN_COMPARE = YES; GCC_WARN_STRICT_SELECTOR_MATCH = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNKNOWN_PRAGMAS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_LABEL = YES; GCC_WARN_UNUSED_PARAMETER = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.7; SDKROOT = macosx; VALID_ARCHS = x86_64; WARNING_CFLAGS = "-Weverything"; }; name = Release; }; 018BBC8313A37041005CA505 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_OBJC_EXCEPTIONS = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselMac/iCarouselMac-Prefix.pch"; INFOPLIST_FILE = "iCarouselMac/iCarouselMac-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; name = Debug; }; 018BBC8413A37041005CA505 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_ENABLE_OBJC_EXCEPTIONS = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselMac/iCarouselMac-Prefix.pch"; INFOPLIST_FILE = "iCarouselMac/iCarouselMac-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 018BBC5E13A37041005CA505 /* Build configuration list for PBXProject "iCarouselMac" */ = { isa = XCConfigurationList; buildConfigurations = ( 018BBC8013A37041005CA505 /* Debug */, 018BBC8113A37041005CA505 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 018BBC8213A37041005CA505 /* Build configuration list for PBXNativeTarget "iCarouselMac" */ = { isa = XCConfigurationList; buildConfigurations = ( 018BBC8313A37041005CA505 /* Debug */, 018BBC8413A37041005CA505 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 018BBC5B13A37041005CA505 /* Project object */; } ================================================ FILE: Examples/Multiple Carousels/MultipleCarousels-Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleDisplayName ${PRODUCT_NAME} CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIconFile CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1.0 LSRequiresIPhoneOS NSMainNibFile MainWindow UIStatusBarHidden UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight ================================================ FILE: Examples/Multiple Carousels/MultipleCarousels-Prefix.pch ================================================ // // Prefix header for all source files of the 'iCarouselExample' target in the 'iCarouselExample' project // #import #ifndef __IPHONE_3_0 #warning "This project uses features only available in iPhone SDK 3.0 and later." #endif #ifdef __OBJC__ #import #import #endif ================================================ FILE: Examples/Multiple Carousels/MultipleCarousels.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 01308D9313491C3500453707 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9213491C3500453707 /* UIKit.framework */; }; 01308D9513491C3500453707 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9413491C3500453707 /* Foundation.framework */; }; 01308D9713491C3500453707 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9613491C3500453707 /* CoreGraphics.framework */; }; 01308DC013491F7200453707 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308DBF13491F7200453707 /* QuartzCore.framework */; }; 0148358813A36C2000E687AC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358313A36C2000E687AC /* main.m */; }; 0148359313A36C3700E687AC /* iCarouselExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */; }; 0148359413A36C3700E687AC /* iCarouselExampleAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */; }; 0148359513A36C3700E687AC /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0148358F13A36C3700E687AC /* MainWindow.xib */; }; 0148359613A36C3700E687AC /* iCarouselExampleViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */; }; 018AE9B7179E73E900FB7311 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 018AE9B6179E73E900FB7311 /* Default-568h@2x.png */; }; B2E5E6C1146145C900EADB7A /* iCarousel.m in Sources */ = {isa = PBXBuildFile; fileRef = B2E5E6C0146145C900EADB7A /* iCarousel.m */; }; B2E5E72D1461544B00EADB7A /* background.png in Resources */ = {isa = PBXBuildFile; fileRef = B2E5E72B1461544B00EADB7A /* background.png */; }; B2E5E72E1461544B00EADB7A /* page.png in Resources */ = {isa = PBXBuildFile; fileRef = B2E5E72C1461544B00EADB7A /* page.png */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 01308D9213491C3500453707 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 01308D9413491C3500453707 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 01308D9613491C3500453707 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 01308DBF13491F7200453707 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 0148358313A36C2000E687AC /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = SOURCE_ROOT; }; 0148358413A36C2000E687AC /* MultipleCarousels-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "MultipleCarousels-Info.plist"; sourceTree = SOURCE_ROOT; }; 0148358513A36C2000E687AC /* MultipleCarousels-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MultipleCarousels-Prefix.pch"; sourceTree = SOURCE_ROOT; }; 0148358713A36C2000E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = SOURCE_ROOT; }; 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleViewController.m; sourceTree = SOURCE_ROOT; }; 0148358C13A36C3700E687AC /* iCarouselExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleViewController.h; sourceTree = SOURCE_ROOT; }; 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleAppDelegate.m; sourceTree = SOURCE_ROOT; }; 0148358E13A36C3700E687AC /* iCarouselExampleAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleAppDelegate.h; sourceTree = SOURCE_ROOT; }; 0148359013A36C3700E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainWindow.xib; sourceTree = SOURCE_ROOT; }; 0148359213A36C3700E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/iCarouselExampleViewController.xib; sourceTree = SOURCE_ROOT; }; 018AE9B6179E73E900FB7311 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = SOURCE_ROOT; }; 018BBCB413A375AF005CA505 /* MultipleCarousels.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MultipleCarousels.app; sourceTree = BUILT_PRODUCTS_DIR; }; B2E5E6BF146145C900EADB7A /* iCarousel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarousel.h; sourceTree = ""; }; B2E5E6C0146145C900EADB7A /* iCarousel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarousel.m; sourceTree = ""; }; B2E5E72B1461544B00EADB7A /* background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = background.png; path = ../Resources/background.png; sourceTree = SOURCE_ROOT; }; B2E5E72C1461544B00EADB7A /* page.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = page.png; path = ../Resources/page.png; sourceTree = SOURCE_ROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 01308D8B13491C3500453707 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 01308DC013491F7200453707 /* QuartzCore.framework in Frameworks */, 01308D9313491C3500453707 /* UIKit.framework in Frameworks */, 01308D9513491C3500453707 /* Foundation.framework in Frameworks */, 01308D9713491C3500453707 /* CoreGraphics.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 01308D8313491C3500453707 = { isa = PBXGroup; children = ( B2E5E6BE146145C900EADB7A /* iCarousel */, 01308D9813491C3500453707 /* iCarouselExample */, 01308D9113491C3500453707 /* Frameworks */, 01308D8F13491C3500453707 /* Products */, ); sourceTree = ""; }; 01308D8F13491C3500453707 /* Products */ = { isa = PBXGroup; children = ( 018BBCB413A375AF005CA505 /* MultipleCarousels.app */, ); name = Products; sourceTree = ""; }; 01308D9113491C3500453707 /* Frameworks */ = { isa = PBXGroup; children = ( 01308DBF13491F7200453707 /* QuartzCore.framework */, 01308D9213491C3500453707 /* UIKit.framework */, 01308D9413491C3500453707 /* Foundation.framework */, 01308D9613491C3500453707 /* CoreGraphics.framework */, ); name = Frameworks; sourceTree = ""; }; 01308D9813491C3500453707 /* iCarouselExample */ = { isa = PBXGroup; children = ( 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */, 0148358C13A36C3700E687AC /* iCarouselExampleViewController.h */, 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */, 0148358E13A36C3700E687AC /* iCarouselExampleAppDelegate.h */, 0148358F13A36C3700E687AC /* MainWindow.xib */, 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */, B2E5E72A1461543E00EADB7A /* Resources */, 01308D9913491C3500453707 /* Supporting Files */, ); path = iCarouselExample; sourceTree = ""; }; 01308D9913491C3500453707 /* Supporting Files */ = { isa = PBXGroup; children = ( 0148358313A36C2000E687AC /* main.m */, 0148358413A36C2000E687AC /* MultipleCarousels-Info.plist */, 0148358513A36C2000E687AC /* MultipleCarousels-Prefix.pch */, 0148358613A36C2000E687AC /* InfoPlist.strings */, ); name = "Supporting Files"; sourceTree = ""; }; B2E5E6BE146145C900EADB7A /* iCarousel */ = { isa = PBXGroup; children = ( B2E5E6BF146145C900EADB7A /* iCarousel.h */, B2E5E6C0146145C900EADB7A /* iCarousel.m */, ); name = iCarousel; path = ../../iCarousel; sourceTree = ""; }; B2E5E72A1461543E00EADB7A /* Resources */ = { isa = PBXGroup; children = ( 018AE9B6179E73E900FB7311 /* Default-568h@2x.png */, B2E5E72B1461544B00EADB7A /* background.png */, B2E5E72C1461544B00EADB7A /* page.png */, ); name = Resources; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 01308D8D13491C3500453707 /* MultipleCarousels */ = { isa = PBXNativeTarget; buildConfigurationList = 01308DAF13491C3500453707 /* Build configuration list for PBXNativeTarget "MultipleCarousels" */; buildPhases = ( 01308D8A13491C3500453707 /* Sources */, 01308D8B13491C3500453707 /* Frameworks */, 01308D8C13491C3500453707 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = MultipleCarousels; productName = iCarouselExample; productReference = 018BBCB413A375AF005CA505 /* MultipleCarousels.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 01308D8513491C3500453707 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0800; }; buildConfigurationList = 01308D8813491C3500453707 /* Build configuration list for PBXProject "MultipleCarousels" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); mainGroup = 01308D8313491C3500453707; productRefGroup = 01308D8F13491C3500453707 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 01308D8D13491C3500453707 /* MultipleCarousels */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 01308D8C13491C3500453707 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 0148359513A36C3700E687AC /* MainWindow.xib in Resources */, 0148359613A36C3700E687AC /* iCarouselExampleViewController.xib in Resources */, B2E5E72D1461544B00EADB7A /* background.png in Resources */, B2E5E72E1461544B00EADB7A /* page.png in Resources */, 018AE9B7179E73E900FB7311 /* Default-568h@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 01308D8A13491C3500453707 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 0148358813A36C2000E687AC /* main.m in Sources */, 0148359313A36C3700E687AC /* iCarouselExampleViewController.m in Sources */, 0148359413A36C3700E687AC /* iCarouselExampleAppDelegate.m in Sources */, B2E5E6C1146145C900EADB7A /* iCarousel.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 0148358613A36C2000E687AC /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( 0148358713A36C2000E687AC /* en */, ); name = InfoPlist.strings; sourceTree = ""; }; 0148358F13A36C3700E687AC /* MainWindow.xib */ = { isa = PBXVariantGroup; children = ( 0148359013A36C3700E687AC /* en */, ); name = MainWindow.xib; sourceTree = ""; }; 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */ = { isa = PBXVariantGroup; children = ( 0148359213A36C3700E687AC /* en */, ); name = iCarouselExampleViewController.xib; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 01308DAD13491C3500453707 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = DEBUG; GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; }; name = Debug; }; 01308DAE13491C3500453707 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; SDKROOT = iphoneos; }; name = Release; }; 01308DB013491C3500453707 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "MultipleCarousels-Prefix.pch"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = "MultipleCarousels-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = MultipleCarousels; TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = app; }; name = Debug; }; 01308DB113491C3500453707 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "MultipleCarousels-Prefix.pch"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = "MultipleCarousels-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = MultipleCarousels; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; WRAPPER_EXTENSION = app; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 01308D8813491C3500453707 /* Build configuration list for PBXProject "MultipleCarousels" */ = { isa = XCConfigurationList; buildConfigurations = ( 01308DAD13491C3500453707 /* Debug */, 01308DAE13491C3500453707 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 01308DAF13491C3500453707 /* Build configuration list for PBXNativeTarget "MultipleCarousels" */ = { isa = XCConfigurationList; buildConfigurations = ( 01308DB013491C3500453707 /* Debug */, 01308DB113491C3500453707 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 01308D8513491C3500453707 /* Project object */; } ================================================ FILE: Examples/Multiple Carousels/en.lproj/InfoPlist.strings ================================================ /* Localized versions of Info.plist keys */ ================================================ FILE: Examples/Multiple Carousels/en.lproj/MainWindow.xib ================================================ 1024 10D571 786 1038.29 460.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin 112 YES YES com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES YES YES IBFilesOwner IBCocoaTouchFramework IBFirstResponder IBCocoaTouchFramework IBCocoaTouchFramework iCarouselExampleViewController 1 IBCocoaTouchFramework NO 292 {320, 480} 1 MSAxIDEAA NO NO IBCocoaTouchFramework YES YES delegate 4 viewController 11 window 14 YES 0 -1 File's Owner 3 iCarouselExample App Delegate -2 10 12 YES YES -1.CustomClassName -2.CustomClassName 10.CustomClassName 10.IBEditorWindowLastContentRect 10.IBPluginDependency 12.IBEditorWindowLastContentRect 12.IBPluginDependency 3.CustomClassName 3.IBPluginDependency YES UIApplication UIResponder iCarouselExampleViewController {{234, 376}, {320, 480}} com.apple.InterfaceBuilder.IBCocoaTouchPlugin {{525, 346}, {320, 480}} com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarouselExampleAppDelegate com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES YES YES 15 YES UIWindow UIView IBUserSource iCarouselExampleAppDelegate NSObject YES YES viewController window YES iCarouselExampleViewController UIWindow YES YES viewController window YES viewController iCarouselExampleViewController window UIWindow IBProjectSource iCarouselExampleAppDelegate.h iCarouselExampleAppDelegate NSObject IBUserSource iCarouselExampleViewController UIViewController IBProjectSource iCarouselExampleViewController.h YES NSObject IBFrameworkSource Foundation.framework/Headers/NSError.h NSObject IBFrameworkSource Foundation.framework/Headers/NSFileManager.h NSObject IBFrameworkSource Foundation.framework/Headers/NSKeyValueCoding.h NSObject IBFrameworkSource Foundation.framework/Headers/NSKeyValueObserving.h NSObject IBFrameworkSource Foundation.framework/Headers/NSKeyedArchiver.h NSObject IBFrameworkSource Foundation.framework/Headers/NSObject.h NSObject IBFrameworkSource Foundation.framework/Headers/NSRunLoop.h NSObject IBFrameworkSource Foundation.framework/Headers/NSThread.h NSObject IBFrameworkSource Foundation.framework/Headers/NSURL.h NSObject IBFrameworkSource Foundation.framework/Headers/NSURLConnection.h NSObject IBFrameworkSource UIKit.framework/Headers/UIAccessibility.h NSObject IBFrameworkSource UIKit.framework/Headers/UINibLoading.h NSObject IBFrameworkSource UIKit.framework/Headers/UIResponder.h UIApplication UIResponder IBFrameworkSource UIKit.framework/Headers/UIApplication.h UIResponder NSObject UISearchBar UIView IBFrameworkSource UIKit.framework/Headers/UISearchBar.h UISearchDisplayController NSObject IBFrameworkSource UIKit.framework/Headers/UISearchDisplayController.h UIView IBFrameworkSource UIKit.framework/Headers/UITextField.h UIView UIResponder IBFrameworkSource UIKit.framework/Headers/UIView.h UIViewController IBFrameworkSource UIKit.framework/Headers/UINavigationController.h UIViewController IBFrameworkSource UIKit.framework/Headers/UIPopoverController.h UIViewController IBFrameworkSource UIKit.framework/Headers/UISplitViewController.h UIViewController IBFrameworkSource UIKit.framework/Headers/UITabBarController.h UIViewController UIResponder IBFrameworkSource UIKit.framework/Headers/UIViewController.h UIWindow UIView IBFrameworkSource UIKit.framework/Headers/UIWindow.h 0 IBCocoaTouchFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 YES iCarouselExample.xcodeproj 3 112 ================================================ FILE: Examples/Multiple Carousels/en.lproj/iCarouselExampleViewController.xib ================================================ 1552 13A603 3084 1265 695.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin 2083 YES IBProxyObject IBUIImageView IBUIView YES com.apple.InterfaceBuilder.IBCocoaTouchPlugin PluginDependencyRecalculationVersion YES IBFilesOwner IBCocoaTouchFramework IBFirstResponder IBCocoaTouchFramework 274 YES 274 {320, 468} NO YES YES IBCocoaTouchFramework NSImage background.png 306 {320, 230} 3 MSAwAA 2 IBCocoaTouchFramework 282 {{0, 230}, {320, 230}} 3 MSAwAA IBCocoaTouchFramework {{0, 20}, {320, 460}} 3 MC43NQA NO IBCocoaTouchFramework YES view 7 carousel1 41 carousel2 42 dataSource 10 delegate 11 dataSource 39 delegate 40 YES 0 YES -1 File's Owner -2 6 YES 8 YES iCarousel 1 21 38 iCarousel 2 YES YES -1.CustomClassName -1.IBPluginDependency -2.CustomClassName -2.IBPluginDependency 21.IBPluginDependency 38.CustomClassName 38.IBPluginDependency 6.IBPluginDependency 8.CustomClassName 8.IBPluginDependency YES iCarouselExampleViewController com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIResponder com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarousel com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarousel com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES 42 YES iCarousel UIView YES YES dataSource delegate YES id id YES YES dataSource delegate YES dataSource id delegate id IBProjectSource ./Classes/iCarousel.h iCarouselExampleViewController UIViewController YES YES carousel1 carousel2 YES iCarousel iCarousel YES YES carousel1 carousel2 YES carousel1 iCarousel carousel2 iCarousel IBProjectSource ./Classes/iCarouselExampleViewController.h 0 IBCocoaTouchFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 YES 3 background.png {50, 468} 2083 ================================================ FILE: Examples/Multiple Carousels/iCarouselExampleAppDelegate.h ================================================ // // iCarouselExampleAppDelegate.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import @class iCarouselExampleViewController; @interface iCarouselExampleAppDelegate : NSObject @property (nonatomic, strong) IBOutlet UIWindow *window; @property (nonatomic, strong) IBOutlet iCarouselExampleViewController *viewController; @end ================================================ FILE: Examples/Multiple Carousels/iCarouselExampleAppDelegate.m ================================================ // // iCarouselExampleAppDelegate.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleAppDelegate.h" #import "iCarouselExampleViewController.h" @implementation iCarouselExampleAppDelegate @synthesize window; @synthesize viewController; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { window.rootViewController = viewController; [window makeKeyAndVisible]; return YES; } @end ================================================ FILE: Examples/Multiple Carousels/iCarouselExampleViewController.h ================================================ // // iCarouselExampleViewController.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import #import "iCarousel.h" @interface iCarouselExampleViewController : UIViewController @property (nonatomic, strong) IBOutlet iCarousel *carousel1; @property (nonatomic, strong) IBOutlet iCarousel *carousel2; @end ================================================ FILE: Examples/Multiple Carousels/iCarouselExampleViewController.m ================================================ // // iCarouselExampleViewController.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleViewController.h" @interface iCarouselExampleViewController () @property (nonatomic, strong) NSMutableArray *items1; @property (nonatomic, strong) NSMutableArray *items2; @end @implementation iCarouselExampleViewController @synthesize carousel1; @synthesize carousel2; @synthesize items1; @synthesize items2; - (void)awakeFromNib { [super awakeFromNib]; //set up data sources self.items1 = [NSMutableArray array]; for (int i = 0; i < 100; i++) { [items1 addObject:[NSNumber numberWithInt:i]]; } self.items2 = [NSMutableArray array]; for (int i = 65; i < 65 + 58; i++) { [items2 addObject:[NSString stringWithFormat:@"%c", i]]; } } - (void)dealloc { //it's a good idea to set these to nil here to avoid //sending messages to a deallocated viewcontroller carousel1.delegate = nil; carousel1.dataSource = nil; carousel2.delegate = nil; carousel2.dataSource = nil; } #pragma mark - #pragma mark View lifecycle - (void)viewDidLoad { [super viewDidLoad]; //configure carousel carousel1.type = iCarouselTypeCoverFlow2; carousel2.type = iCarouselTypeLinear; } - (void)viewDidUnload { [super viewDidUnload]; //free up memory by releasing subviews self.carousel1 = nil; self.carousel2 = nil; } #pragma mark - #pragma mark iCarousel methods - (NSInteger)numberOfItemsInCarousel:(iCarousel *)carousel { //return the total number of items in the carousel if (carousel == carousel1) { return [items1 count]; } else { return [items2 count]; } } - (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view { UILabel *label = nil; //create new view if no view is available for recycling if (view == nil) { view = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 200.0f, 200.0f)]; ((UIImageView *)view).image = [UIImage imageNamed:@"page.png"]; view.contentMode = UIViewContentModeCenter; label = [[UILabel alloc] initWithFrame:view.bounds]; label.backgroundColor = [UIColor clearColor]; label.textAlignment = NSTextAlignmentCenter; label.font = [label.font fontWithSize:50]; [view addSubview:label]; } else { label = [[view subviews] lastObject]; } //set item label //remember to always set any properties of your carousel item //views outside of the `if (view == nil) {...}` check otherwise //you'll get weird issues with carousel item content appearing //in the wrong place in the carousel if (carousel == carousel1) { //items in this array are numbers label.text = [[items1 objectAtIndex:index] stringValue]; } else { //items in this array are strings label.text = [items2 objectAtIndex:index]; } return view; } - (CGFloat)carousel:(iCarousel *)carousel valueForOption:(iCarouselOption)option withDefault:(CGFloat)value { //customize carousel display switch (option) { case iCarouselOptionSpacing: { if (carousel == carousel2) { //add a bit of spacing between the item views return value * 1.05f; } } default: { return value; } } } @end ================================================ FILE: Examples/Multiple Carousels/main.m ================================================ // // main.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import int main(int argc, char *argv[]) { @autoreleasepool { int retVal = UIApplicationMain(argc, argv, nil, nil); return retVal; } } ================================================ FILE: Examples/Nested Carousels/en.lproj/InfoPlist.strings ================================================ /* Localized versions of Info.plist keys */ ================================================ FILE: Examples/Nested Carousels/en.lproj/MainWindow.xib ================================================ 1552 12E55 3084 1187.39 626.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin 2083 YES IBProxyObject IBUICustomObject IBUIViewController IBUIWindow YES com.apple.InterfaceBuilder.IBCocoaTouchPlugin PluginDependencyRecalculationVersion YES IBFilesOwner IBCocoaTouchFramework IBFirstResponder IBCocoaTouchFramework IBCocoaTouchFramework iCarouselExampleViewController 1 1 IBCocoaTouchFramework NO 292 {320, 480} 1 MSAxIDEAA NO NO IBCocoaTouchFramework YES YES delegate 4 viewController 11 window 14 rootViewController 16 YES 0 YES -1 File's Owner 3 iCarouselExample App Delegate -2 10 12 YES YES -1.CustomClassName -1.IBPluginDependency -2.CustomClassName -2.IBPluginDependency 10.CustomClassName 10.IBPluginDependency 12.IBPluginDependency 3.CustomClassName 3.IBPluginDependency YES UIApplication com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIResponder com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarouselExampleViewController com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarouselExampleAppDelegate com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES 16 YES iCarousel UIView YES YES dataSource delegate YES id id YES YES dataSource delegate YES dataSource id delegate id IBProjectSource ./Classes/iCarousel.h iCarouselExampleAppDelegate NSObject YES YES viewController window YES iCarouselExampleViewController UIWindow YES YES viewController window YES viewController iCarouselExampleViewController window UIWindow IBProjectSource ./Classes/iCarouselExampleAppDelegate.h iCarouselExampleViewController UIViewController carousel iCarousel carousel carousel iCarousel IBProjectSource ./Classes/iCarouselExampleViewController.h 0 IBCocoaTouchFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 YES 3 2083 ================================================ FILE: Examples/Nested Carousels/en.lproj/iCarouselExampleViewController.xib ================================================ 1552 12E55 3084 1187.39 626.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin 2083 YES IBProxyObject IBUIImageView IBUIView YES com.apple.InterfaceBuilder.IBCocoaTouchPlugin PluginDependencyRecalculationVersion YES IBFilesOwner IBCocoaTouchFramework IBFirstResponder IBCocoaTouchFramework 274 YES 274 {320, 468} NO YES YES IBCocoaTouchFramework NSImage background.png 274 {320, 460} 3 MSAwAA 2 IBCocoaTouchFramework {{0, 20}, {320, 460}} 3 MC43NQA NO IBCocoaTouchFramework YES view 7 carousel 9 dataSource 10 delegate 11 YES 0 YES -1 File's Owner -2 6 YES 8 YES iCarousel 21 YES YES -1.CustomClassName -1.IBPluginDependency -2.CustomClassName -2.IBPluginDependency 21.IBPluginDependency 6.IBPluginDependency 8.CustomClassName 8.IBPluginDependency YES iCarouselExampleViewController com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIResponder com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarousel com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES 37 0 IBCocoaTouchFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 YES 3 background.png {50, 468} 2083 ================================================ FILE: Examples/Nested Carousels/iCarouselExample-Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleDisplayName ${PRODUCT_NAME} CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIconFile CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1.0 LSRequiresIPhoneOS NSMainNibFile MainWindow UIStatusBarHidden UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight ================================================ FILE: Examples/Nested Carousels/iCarouselExample-Prefix.pch ================================================ // // Prefix header for all source files of the 'iCarouselExample' target in the 'iCarouselExample' project // #import #ifndef __IPHONE_3_0 #warning "This project uses features only available in iPhone SDK 3.0 and later." #endif #ifdef __OBJC__ #import #import #endif ================================================ FILE: Examples/Nested Carousels/iCarouselExample.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 01308D9313491C3500453707 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9213491C3500453707 /* UIKit.framework */; }; 01308D9513491C3500453707 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9413491C3500453707 /* Foundation.framework */; }; 01308D9713491C3500453707 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9613491C3500453707 /* CoreGraphics.framework */; }; 01308DC013491F7200453707 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308DBF13491F7200453707 /* QuartzCore.framework */; }; 0148358813A36C2000E687AC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358313A36C2000E687AC /* main.m */; }; 0148359313A36C3700E687AC /* iCarouselExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */; }; 0148359413A36C3700E687AC /* iCarouselExampleAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */; }; 0148359513A36C3700E687AC /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0148358F13A36C3700E687AC /* MainWindow.xib */; }; 0148359613A36C3700E687AC /* iCarouselExampleViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */; }; B2E5E6C1146145C900EADB7A /* iCarousel.m in Sources */ = {isa = PBXBuildFile; fileRef = B2E5E6C0146145C900EADB7A /* iCarousel.m */; }; B2E5E72D1461544B00EADB7A /* background.png in Resources */ = {isa = PBXBuildFile; fileRef = B2E5E72B1461544B00EADB7A /* background.png */; }; B2E5E72E1461544B00EADB7A /* page.png in Resources */ = {isa = PBXBuildFile; fileRef = B2E5E72C1461544B00EADB7A /* page.png */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 01308D9213491C3500453707 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 01308D9413491C3500453707 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 01308D9613491C3500453707 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 01308DBF13491F7200453707 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 0148358313A36C2000E687AC /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = SOURCE_ROOT; }; 0148358413A36C2000E687AC /* iCarouselExample-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "iCarouselExample-Info.plist"; sourceTree = SOURCE_ROOT; }; 0148358513A36C2000E687AC /* iCarouselExample-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "iCarouselExample-Prefix.pch"; sourceTree = SOURCE_ROOT; }; 0148358713A36C2000E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = SOURCE_ROOT; }; 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleViewController.m; sourceTree = SOURCE_ROOT; }; 0148358C13A36C3700E687AC /* iCarouselExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleViewController.h; sourceTree = SOURCE_ROOT; }; 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleAppDelegate.m; sourceTree = SOURCE_ROOT; }; 0148358E13A36C3700E687AC /* iCarouselExampleAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleAppDelegate.h; sourceTree = SOURCE_ROOT; }; 0148359013A36C3700E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainWindow.xib; sourceTree = SOURCE_ROOT; }; 0148359213A36C3700E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/iCarouselExampleViewController.xib; sourceTree = SOURCE_ROOT; }; 018BBCB413A375AF005CA505 /* iCarouselExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iCarouselExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; B2E5E6BF146145C900EADB7A /* iCarousel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarousel.h; sourceTree = ""; }; B2E5E6C0146145C900EADB7A /* iCarousel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarousel.m; sourceTree = ""; }; B2E5E72B1461544B00EADB7A /* background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = background.png; path = ../Resources/background.png; sourceTree = SOURCE_ROOT; }; B2E5E72C1461544B00EADB7A /* page.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = page.png; path = ../Resources/page.png; sourceTree = SOURCE_ROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 01308D8B13491C3500453707 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 01308DC013491F7200453707 /* QuartzCore.framework in Frameworks */, 01308D9313491C3500453707 /* UIKit.framework in Frameworks */, 01308D9513491C3500453707 /* Foundation.framework in Frameworks */, 01308D9713491C3500453707 /* CoreGraphics.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 01308D8313491C3500453707 = { isa = PBXGroup; children = ( B2E5E6BE146145C900EADB7A /* iCarousel */, 01308D9813491C3500453707 /* iCarouselExample */, 01308D9113491C3500453707 /* Frameworks */, 01308D8F13491C3500453707 /* Products */, ); sourceTree = ""; }; 01308D8F13491C3500453707 /* Products */ = { isa = PBXGroup; children = ( 018BBCB413A375AF005CA505 /* iCarouselExample.app */, ); name = Products; sourceTree = ""; }; 01308D9113491C3500453707 /* Frameworks */ = { isa = PBXGroup; children = ( 01308DBF13491F7200453707 /* QuartzCore.framework */, 01308D9213491C3500453707 /* UIKit.framework */, 01308D9413491C3500453707 /* Foundation.framework */, 01308D9613491C3500453707 /* CoreGraphics.framework */, ); name = Frameworks; sourceTree = ""; }; 01308D9813491C3500453707 /* iCarouselExample */ = { isa = PBXGroup; children = ( 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */, 0148358C13A36C3700E687AC /* iCarouselExampleViewController.h */, 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */, 0148358E13A36C3700E687AC /* iCarouselExampleAppDelegate.h */, 0148358F13A36C3700E687AC /* MainWindow.xib */, 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */, B2E5E72A1461543E00EADB7A /* Resources */, 01308D9913491C3500453707 /* Supporting Files */, ); path = iCarouselExample; sourceTree = ""; }; 01308D9913491C3500453707 /* Supporting Files */ = { isa = PBXGroup; children = ( 0148358313A36C2000E687AC /* main.m */, 0148358413A36C2000E687AC /* iCarouselExample-Info.plist */, 0148358513A36C2000E687AC /* iCarouselExample-Prefix.pch */, 0148358613A36C2000E687AC /* InfoPlist.strings */, ); name = "Supporting Files"; sourceTree = ""; }; B2E5E6BE146145C900EADB7A /* iCarousel */ = { isa = PBXGroup; children = ( B2E5E6BF146145C900EADB7A /* iCarousel.h */, B2E5E6C0146145C900EADB7A /* iCarousel.m */, ); name = iCarousel; path = ../../iCarousel; sourceTree = ""; }; B2E5E72A1461543E00EADB7A /* Resources */ = { isa = PBXGroup; children = ( B2E5E72B1461544B00EADB7A /* background.png */, B2E5E72C1461544B00EADB7A /* page.png */, ); name = Resources; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 01308D8D13491C3500453707 /* iCarouselExample */ = { isa = PBXNativeTarget; buildConfigurationList = 01308DAF13491C3500453707 /* Build configuration list for PBXNativeTarget "iCarouselExample" */; buildPhases = ( 01308D8A13491C3500453707 /* Sources */, 01308D8B13491C3500453707 /* Frameworks */, 01308D8C13491C3500453707 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = iCarouselExample; productName = iCarouselExample; productReference = 018BBCB413A375AF005CA505 /* iCarouselExample.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 01308D8513491C3500453707 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0800; }; buildConfigurationList = 01308D8813491C3500453707 /* Build configuration list for PBXProject "iCarouselExample" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); mainGroup = 01308D8313491C3500453707; productRefGroup = 01308D8F13491C3500453707 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 01308D8D13491C3500453707 /* iCarouselExample */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 01308D8C13491C3500453707 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 0148359513A36C3700E687AC /* MainWindow.xib in Resources */, 0148359613A36C3700E687AC /* iCarouselExampleViewController.xib in Resources */, B2E5E72D1461544B00EADB7A /* background.png in Resources */, B2E5E72E1461544B00EADB7A /* page.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 01308D8A13491C3500453707 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 0148358813A36C2000E687AC /* main.m in Sources */, 0148359313A36C3700E687AC /* iCarouselExampleViewController.m in Sources */, 0148359413A36C3700E687AC /* iCarouselExampleAppDelegate.m in Sources */, B2E5E6C1146145C900EADB7A /* iCarousel.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 0148358613A36C2000E687AC /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( 0148358713A36C2000E687AC /* en */, ); name = InfoPlist.strings; sourceTree = ""; }; 0148358F13A36C3700E687AC /* MainWindow.xib */ = { isa = PBXVariantGroup; children = ( 0148359013A36C3700E687AC /* en */, ); name = MainWindow.xib; sourceTree = ""; }; 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */ = { isa = PBXVariantGroup; children = ( 0148359213A36C3700E687AC /* en */, ); name = iCarouselExampleViewController.xib; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 01308DAD13491C3500453707 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = DEBUG; GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; }; name = Debug; }; 01308DAE13491C3500453707 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; SDKROOT = iphoneos; }; name = Release; }; 01308DB013491C3500453707 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselExample-Prefix.pch"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = ""; INFOPLIST_FILE = "iCarouselExample-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = iCarouselExample; TARGETED_DEVICE_FAMILY = 2; WRAPPER_EXTENSION = app; }; name = Debug; }; 01308DB113491C3500453707 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselExample-Prefix.pch"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = ""; INFOPLIST_FILE = "iCarouselExample-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = iCarouselExample; TARGETED_DEVICE_FAMILY = 2; VALIDATE_PRODUCT = YES; WRAPPER_EXTENSION = app; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 01308D8813491C3500453707 /* Build configuration list for PBXProject "iCarouselExample" */ = { isa = XCConfigurationList; buildConfigurations = ( 01308DAD13491C3500453707 /* Debug */, 01308DAE13491C3500453707 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 01308DAF13491C3500453707 /* Build configuration list for PBXNativeTarget "iCarouselExample" */ = { isa = XCConfigurationList; buildConfigurations = ( 01308DB013491C3500453707 /* Debug */, 01308DB113491C3500453707 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 01308D8513491C3500453707 /* Project object */; } ================================================ FILE: Examples/Nested Carousels/iCarouselExampleAppDelegate.h ================================================ // // iCarouselExampleAppDelegate.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import @class iCarouselExampleViewController; @interface iCarouselExampleAppDelegate : NSObject @property (nonatomic, strong) IBOutlet UIWindow *window; @property (nonatomic, strong) IBOutlet iCarouselExampleViewController *viewController; @end ================================================ FILE: Examples/Nested Carousels/iCarouselExampleAppDelegate.m ================================================ // // iCarouselExampleAppDelegate.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleAppDelegate.h" #import "iCarouselExampleViewController.h" @implementation iCarouselExampleAppDelegate @synthesize window; @synthesize viewController; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [window addSubview:viewController.view]; [window makeKeyAndVisible]; return YES; } @end ================================================ FILE: Examples/Nested Carousels/iCarouselExampleViewController.h ================================================ // // iCarouselExampleViewController.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import #import "iCarousel.h" @interface iCarouselExampleViewController : UIViewController @end ================================================ FILE: Examples/Nested Carousels/iCarouselExampleViewController.m ================================================ // // iCarouselExampleViewController.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleViewController.h" #define SYNCHRONIZE_CAROUSELS NO @interface iCarouselExampleViewController () @property (nonatomic, strong) IBOutlet iCarousel *carousel; @property (nonatomic, strong) NSMutableArray *items; @end @implementation iCarouselExampleViewController - (id)initWithCoder:(NSCoder *)aDecoder { if ((self = [super initWithCoder:aDecoder])) { //set up data //this is an array of arrays self.items = [NSMutableArray array]; for (int i = 0; i < 100; i++) { NSMutableArray *subitems = [NSMutableArray array]; for (int j = 0; j < 20; j++) { [subitems addObject:[NSNumber numberWithInt:j]]; } [_items addObject:subitems]; } } return self; } - (void)updatePerspective { for (iCarousel *subCarousel in _carousel.visibleItemViews) { NSInteger index = subCarousel.tag; CGFloat offset = [_carousel offsetForItemAtIndex:index]; subCarousel.viewpointOffset = CGSizeMake(-offset * _carousel.itemWidth, 0.0f); subCarousel.contentOffset = CGSizeMake(-offset * _carousel.itemWidth, 0.0f); } } - (void)dealloc { //it's a good idea to set these to nil here to avoid //sending messages to a deallocated viewcontroller //this is true even if your project is using ARC, unless //you are targeting iOS 5 as a minimum deployment target _carousel.delegate = nil; _carousel.dataSource = nil; } #pragma mark - #pragma mark View lifecycle - (void)viewDidLoad { [super viewDidLoad]; //configure outer carousel _carousel.type = iCarouselTypeLinear; _carousel.centerItemWhenSelected = NO; } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [self updatePerspective]; } - (void)viewDidUnload { [super viewDidUnload]; //free up memory by releasing subviews self.carousel = nil; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } #pragma mark - #pragma mark iCarousel methods - (CGFloat)carouselItemWidth:(iCarousel *)carousel { if (carousel == _carousel) { return 210.0f; } else { return 210.0f; } } - (NSInteger)numberOfItemsInCarousel:(iCarousel *)carousel { if (carousel == _carousel) { return [_items count]; } else { NSInteger index = carousel.tag; return [[_items objectAtIndex:index] count]; } } - (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view { if (carousel == _carousel) { //item for outer carousel iCarousel *subCarousel = (iCarousel *)view; if (view == nil) { subCarousel = [[iCarousel alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 200.0f, self.view.bounds.size.height)]; subCarousel.dataSource = self; subCarousel.delegate = self; subCarousel.vertical = YES; subCarousel.type = iCarouselTypeCylinder; view = subCarousel; } //configure view //you might want to restore a saved scrollOffset here //but for now we'll just set it to zero subCarousel.scrollOffset = 0.0f; subCarousel.tag = index; } else { //item for inner carousel UILabel *label = nil; //create new view if no view is available for recycling if (view == nil) { UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 200.0f, 200.0f)]; imageView.image = [UIImage imageNamed:@"page.png"]; imageView.contentMode = UIViewContentModeCenter; view = imageView; label = [[UILabel alloc] initWithFrame:view.bounds]; label.backgroundColor = [UIColor clearColor]; label.textAlignment = NSTextAlignmentCenter; label.font = [label.font fontWithSize:50]; label.tag = 1; [view addSubview:label]; } else { //get a reference to the label in the recycled view label = (UILabel *)[view viewWithTag:1]; } //configure view NSInteger outerIndex = carousel.tag; NSArray *subItems = [_items objectAtIndex:outerIndex]; label.text = [[subItems objectAtIndex:index] stringValue]; } //return view return view; } - (void)carouselDidScroll:(iCarousel *)carousel { if (carousel == _carousel) { //adjust perspective for inner carousels //every time the outer carousel is moved //for 2D carousel styles this wouldn't be neccesary [self updatePerspective]; } else if (SYNCHRONIZE_CAROUSELS) { //synchronise inner carousel scroll offsets each time any //of the inner carousels is moved - if you don't want this //you can turn it off, but then you'd need to keep track of //the scroll state for each carousel when they are loaded/unloaded for (iCarousel *subCarousel in _carousel.visibleItemViews) { subCarousel.scrollOffset = carousel.scrollOffset; } } } - (CGFloat)carousel:(iCarousel *)carousel valueForOption:(iCarouselOption)option withDefault:(CGFloat)value { switch (option) { case iCarouselOptionShowBackfaces: { //depths sorting doesn't really work for //nested carousels, so it looks pretty odd //if you change this to YES return NO; } case iCarouselOptionVisibleItems: { if (carousel == _carousel) { //the standard visible items calculation //cuts off the carousel a bit early if the //inner views are also 3D - here we increase //the visible item count a bit return value + 2; } return value; } case iCarouselOptionCount: { if (carousel != _carousel) { //precisely control the carousel //size for the inner carousels return 12; } return value; } default: { return value; } } } @end ================================================ FILE: Examples/Nested Carousels/main.m ================================================ // // main.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import int main(int argc, char *argv[]) { @autoreleasepool { int retVal = UIApplicationMain(argc, argv, nil, nil); return retVal; } } ================================================ FILE: Examples/No Nib Demo/en.lproj/InfoPlist.strings ================================================ /* Localized versions of Info.plist keys */ ================================================ FILE: Examples/No Nib Demo/iCarouselExampleAppDelegate.h ================================================ // // iCarouselExampleAppDelegate.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import @interface iCarouselExampleAppDelegate : NSObject @property (nonatomic, strong) IBOutlet UIWindow *window; @end ================================================ FILE: Examples/No Nib Demo/iCarouselExampleAppDelegate.m ================================================ // // iCarouselExampleAppDelegate.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleAppDelegate.h" #import "iCarouselExampleViewController.h" @implementation iCarouselExampleAppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { _window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; _window.rootViewController = [[iCarouselExampleViewController alloc] init]; [_window makeKeyAndVisible]; return YES; } @end ================================================ FILE: Examples/No Nib Demo/iCarouselExampleViewController.h ================================================ // // iCarouselExampleViewController.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import @interface iCarouselExampleViewController : UIViewController @end ================================================ FILE: Examples/No Nib Demo/iCarouselExampleViewController.m ================================================ // // iCarouselExampleViewController.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleViewController.h" #import "iCarousel.h" @interface iCarouselExampleViewController () @property (nonatomic, strong) iCarousel *carousel; @property (nonatomic, strong) UINavigationItem *navItem; @property (nonatomic, assign) BOOL wrap; @property (nonatomic, strong) NSMutableArray *items; @end @implementation iCarouselExampleViewController - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { //set up data self.items = [NSMutableArray array]; for (int i = 0; i < 1000; i++) { [_items addObject:@(i)]; } } return self; } - (void)dealloc { //it's a good idea to set these to nil here to avoid //sending messages to a deallocated viewcontroller _carousel.delegate = nil; _carousel.dataSource = nil; } #pragma mark - #pragma mark View lifecycle - (void)viewDidLoad { [super viewDidLoad]; _wrap = YES; //add background UIImageView *backgroundView = [[UIImageView alloc] initWithFrame:self.view.bounds]; backgroundView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; backgroundView.image = [UIImage imageNamed:@"background.png"]; [self.view addSubview:backgroundView]; //create carousel _carousel = [[iCarousel alloc] initWithFrame:self.view.bounds]; _carousel.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; _carousel.type = iCarouselTypeCoverFlow2; _carousel.delegate = self; _carousel.dataSource = self; //add carousel to view [self.view addSubview:_carousel]; //add top bar UINavigationBar *navbar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 44)]; navbar.autoresizingMask = UIViewAutoresizingFlexibleWidth; self.navItem = [[UINavigationItem alloc] initWithTitle:@"Coverflow2"]; _navItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Switch Type" style:UIBarButtonItemStylePlain target:self action:@selector(switchCarouselType)]; _navItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Wrap: ON" style:UIBarButtonItemStylePlain target:self action:@selector(toggleWrap)]; [navbar setItems:@[_navItem]]; [self.view addSubview:navbar]; //add bottom bar UIToolbar *toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, self.view.bounds.size.height - 44, self.view.bounds.size.width, 44)]; toolbar.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin; [toolbar setItems:@[[[UIBarButtonItem alloc] initWithTitle:@"Insert Item" style:UIBarButtonItemStylePlain target:self action:@selector(insertItem)], [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:NULL], [[UIBarButtonItem alloc] initWithTitle:@"Delete Item" style:UIBarButtonItemStylePlain target:self action:@selector(removeItem)]]]; [self.view addSubview:toolbar]; } - (void)viewDidUnload { [super viewDidUnload]; self.carousel = nil; self.navItem = nil; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } - (IBAction)switchCarouselType { UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@"Select Carousel Type" delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:@"Linear", @"Rotary", @"Inverted Rotary", @"Cylinder", @"Inverted Cylinder", @"Wheel", @"Inverted Wheel", @"CoverFlow", @"CoverFlow2", @"Time Machine", @"Inverted Time Machine", @"Custom", nil]; [sheet showInView:self.view]; } - (IBAction)toggleWrap { _wrap = !_wrap; _navItem.rightBarButtonItem.title = _wrap? @"Wrap: ON": @"Wrap: OFF"; [_carousel reloadData]; } - (IBAction)insertItem { NSInteger index = _carousel.currentItemIndex; [_items insertObject:@(_carousel.numberOfItems) atIndex:index]; [_carousel insertItemAtIndex:index animated:YES]; } - (IBAction)removeItem { if (_carousel.numberOfItems > 0) { NSInteger index = _carousel.currentItemIndex; [_carousel removeItemAtIndex:index animated:YES]; [_items removeObjectAtIndex:index]; } } #pragma mark - #pragma mark UIActionSheet methods - (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex { if (buttonIndex >= 0) { //map button index to carousel type iCarouselType type = buttonIndex; //carousel can smoothly animate between types [UIView beginAnimations:nil context:nil]; _carousel.type = type; [UIView commitAnimations]; //update title _navItem.title = [actionSheet buttonTitleAtIndex:buttonIndex]; } } #pragma mark - #pragma mark iCarousel methods - (NSInteger)numberOfItemsInCarousel:(iCarousel *)carousel { return [_items count]; } - (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view { UILabel *label = nil; //create new view if no view is available for recycling if (view == nil) { view = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 200.0f, 200.0f)]; ((UIImageView *)view).image = [UIImage imageNamed:@"page.png"]; view.contentMode = UIViewContentModeCenter; label = [[UILabel alloc] initWithFrame:view.bounds]; label.backgroundColor = [UIColor clearColor]; label.textAlignment = NSTextAlignmentCenter; label.font = [label.font fontWithSize:50]; label.tag = 1; [view addSubview:label]; } else { //get a reference to the label in the recycled view label = (UILabel *)[view viewWithTag:1]; } //set item label //remember to always set any properties of your carousel item //views outside of the `if (view == nil) {...}` check otherwise //you'll get weird issues with carousel item content appearing //in the wrong place in the carousel label.text = [_items[index] stringValue]; return view; } - (CATransform3D)carousel:(iCarousel *)carousel itemTransformForOffset:(CGFloat)offset baseTransform:(CATransform3D)transform { //implement 'flip3D' style carousel transform = CATransform3DRotate(transform, M_PI / 8.0f, 0.0f, 1.0f, 0.0f); return CATransform3DTranslate(transform, 0.0f, 0.0f, offset * carousel.itemWidth); } - (CGFloat)carousel:(iCarousel *)carousel valueForOption:(iCarouselOption)option withDefault:(CGFloat)value { //customize carousel display switch (option) { case iCarouselOptionWrap: { //normally you would hard-code this to YES or NO return _wrap; } case iCarouselOptionSpacing: { //add a bit of spacing between the item views return value * 1.05f; } case iCarouselOptionFadeMax: { if (carousel.type == iCarouselTypeCustom) { //set opacity based on distance from camera return 0.0f; } return value; } default: { return value; } } } @end ================================================ FILE: Examples/No Nib Demo/iCarouselNoNibDemo-Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleDisplayName ${PRODUCT_NAME} CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIconFile CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1.0 LSRequiresIPhoneOS UIStatusBarHidden UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight ================================================ FILE: Examples/No Nib Demo/iCarouselNoNibDemo-Prefix.pch ================================================ // // Prefix header for all source files of the 'iCarouselExample' target in the 'iCarouselExample' project // #import #ifndef __IPHONE_3_0 #warning "This project uses features only available in iPhone SDK 3.0 and later." #endif #ifdef __OBJC__ #import #import #endif ================================================ FILE: Examples/No Nib Demo/iCarouselNoNibDemo.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 01308D9313491C3500453707 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9213491C3500453707 /* UIKit.framework */; }; 01308D9513491C3500453707 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9413491C3500453707 /* Foundation.framework */; }; 01308D9713491C3500453707 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9613491C3500453707 /* CoreGraphics.framework */; }; 01308DC013491F7200453707 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308DBF13491F7200453707 /* QuartzCore.framework */; }; 0148358813A36C2000E687AC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358313A36C2000E687AC /* main.m */; }; 0148359313A36C3700E687AC /* iCarouselExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */; }; 0148359413A36C3700E687AC /* iCarouselExampleAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */; }; 018AE9B9179E869A00FB7311 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 018AE9B8179E869A00FB7311 /* Default-568h@2x.png */; }; B2E5E73B146154E200EADB7A /* iCarousel.m in Sources */ = {isa = PBXBuildFile; fileRef = B2E5E73A146154E200EADB7A /* iCarousel.m */; }; B2E5E73F1461550900EADB7A /* background.png in Resources */ = {isa = PBXBuildFile; fileRef = B2E5E73D1461550900EADB7A /* background.png */; }; B2E5E7401461550900EADB7A /* page.png in Resources */ = {isa = PBXBuildFile; fileRef = B2E5E73E1461550900EADB7A /* page.png */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 01308D9213491C3500453707 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 01308D9413491C3500453707 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 01308D9613491C3500453707 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 01308DBF13491F7200453707 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 0148358313A36C2000E687AC /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = SOURCE_ROOT; }; 0148358413A36C2000E687AC /* iCarouselNoNibDemo-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "iCarouselNoNibDemo-Prefix.pch"; sourceTree = SOURCE_ROOT; }; 0148358513A36C2000E687AC /* iCarouselNoNibDemo-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "iCarouselNoNibDemo-Info.plist"; sourceTree = SOURCE_ROOT; }; 0148358713A36C2000E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = SOURCE_ROOT; }; 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleViewController.m; sourceTree = SOURCE_ROOT; }; 0148358C13A36C3700E687AC /* iCarouselExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleViewController.h; sourceTree = SOURCE_ROOT; }; 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleAppDelegate.m; sourceTree = SOURCE_ROOT; }; 0148358E13A36C3700E687AC /* iCarouselExampleAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleAppDelegate.h; sourceTree = SOURCE_ROOT; }; 018AE9B8179E869A00FB7311 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = SOURCE_ROOT; }; 018BBCB413A375AF005CA505 /* iCarouselNoNibDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iCarouselNoNibDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; B2E5E739146154E200EADB7A /* iCarousel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarousel.h; sourceTree = ""; }; B2E5E73A146154E200EADB7A /* iCarousel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarousel.m; sourceTree = ""; }; B2E5E73D1461550900EADB7A /* background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = background.png; path = ../Resources/background.png; sourceTree = SOURCE_ROOT; }; B2E5E73E1461550900EADB7A /* page.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = page.png; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 01308D8B13491C3500453707 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 01308DC013491F7200453707 /* QuartzCore.framework in Frameworks */, 01308D9313491C3500453707 /* UIKit.framework in Frameworks */, 01308D9513491C3500453707 /* Foundation.framework in Frameworks */, 01308D9713491C3500453707 /* CoreGraphics.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 01308D8313491C3500453707 = { isa = PBXGroup; children = ( B2E5E738146154E200EADB7A /* iCarousel */, 01308D9813491C3500453707 /* iCarouselNoNibDemo */, 01308D9113491C3500453707 /* Frameworks */, 01308D8F13491C3500453707 /* Products */, ); sourceTree = ""; }; 01308D8F13491C3500453707 /* Products */ = { isa = PBXGroup; children = ( 018BBCB413A375AF005CA505 /* iCarouselNoNibDemo.app */, ); name = Products; sourceTree = ""; }; 01308D9113491C3500453707 /* Frameworks */ = { isa = PBXGroup; children = ( 01308DBF13491F7200453707 /* QuartzCore.framework */, 01308D9213491C3500453707 /* UIKit.framework */, 01308D9413491C3500453707 /* Foundation.framework */, 01308D9613491C3500453707 /* CoreGraphics.framework */, ); name = Frameworks; sourceTree = ""; }; 01308D9813491C3500453707 /* iCarouselNoNibDemo */ = { isa = PBXGroup; children = ( 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */, 0148358C13A36C3700E687AC /* iCarouselExampleViewController.h */, 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */, 0148358E13A36C3700E687AC /* iCarouselExampleAppDelegate.h */, B2E5E73C1461550900EADB7A /* Resources */, 01308D9913491C3500453707 /* Supporting Files */, ); name = iCarouselNoNibDemo; path = iCarouselExample; sourceTree = ""; }; 01308D9913491C3500453707 /* Supporting Files */ = { isa = PBXGroup; children = ( 018AE9B8179E869A00FB7311 /* Default-568h@2x.png */, 0148358313A36C2000E687AC /* main.m */, 0148358413A36C2000E687AC /* iCarouselNoNibDemo-Prefix.pch */, 0148358513A36C2000E687AC /* iCarouselNoNibDemo-Info.plist */, 0148358613A36C2000E687AC /* InfoPlist.strings */, ); name = "Supporting Files"; sourceTree = ""; }; B2E5E738146154E200EADB7A /* iCarousel */ = { isa = PBXGroup; children = ( B2E5E739146154E200EADB7A /* iCarousel.h */, B2E5E73A146154E200EADB7A /* iCarousel.m */, ); name = iCarousel; path = ../../iCarousel; sourceTree = ""; }; B2E5E73C1461550900EADB7A /* Resources */ = { isa = PBXGroup; children = ( B2E5E73D1461550900EADB7A /* background.png */, B2E5E73E1461550900EADB7A /* page.png */, ); name = Resources; path = ../Resources; sourceTree = SOURCE_ROOT; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 01308D8D13491C3500453707 /* iCarouselNoNibDemo */ = { isa = PBXNativeTarget; buildConfigurationList = 01308DAF13491C3500453707 /* Build configuration list for PBXNativeTarget "iCarouselNoNibDemo" */; buildPhases = ( 01308D8A13491C3500453707 /* Sources */, 01308D8B13491C3500453707 /* Frameworks */, 01308D8C13491C3500453707 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = iCarouselNoNibDemo; productName = iCarouselExample; productReference = 018BBCB413A375AF005CA505 /* iCarouselNoNibDemo.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 01308D8513491C3500453707 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0800; }; buildConfigurationList = 01308D8813491C3500453707 /* Build configuration list for PBXProject "iCarouselNoNibDemo" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); mainGroup = 01308D8313491C3500453707; productRefGroup = 01308D8F13491C3500453707 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 01308D8D13491C3500453707 /* iCarouselNoNibDemo */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 01308D8C13491C3500453707 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( B2E5E73F1461550900EADB7A /* background.png in Resources */, B2E5E7401461550900EADB7A /* page.png in Resources */, 018AE9B9179E869A00FB7311 /* Default-568h@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 01308D8A13491C3500453707 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 0148358813A36C2000E687AC /* main.m in Sources */, 0148359313A36C3700E687AC /* iCarouselExampleViewController.m in Sources */, 0148359413A36C3700E687AC /* iCarouselExampleAppDelegate.m in Sources */, B2E5E73B146154E200EADB7A /* iCarousel.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 0148358613A36C2000E687AC /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( 0148358713A36C2000E687AC /* en */, ); name = InfoPlist.strings; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 01308DAD13491C3500453707 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = DEBUG; GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; }; name = Debug; }; 01308DAE13491C3500453707 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; SDKROOT = iphoneos; }; name = Release; }; 01308DB013491C3500453707 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselNoNibDemo-Prefix.pch"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = "iCarouselNoNibDemo-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = iCarouselNoNibDemo; TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = app; }; name = Debug; }; 01308DB113491C3500453707 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselNoNibDemo-Prefix.pch"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = "iCarouselNoNibDemo-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = iCarouselNoNibDemo; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; WRAPPER_EXTENSION = app; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 01308D8813491C3500453707 /* Build configuration list for PBXProject "iCarouselNoNibDemo" */ = { isa = XCConfigurationList; buildConfigurations = ( 01308DAD13491C3500453707 /* Debug */, 01308DAE13491C3500453707 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 01308DAF13491C3500453707 /* Build configuration list for PBXNativeTarget "iCarouselNoNibDemo" */ = { isa = XCConfigurationList; buildConfigurations = ( 01308DB013491C3500453707 /* Debug */, 01308DB113491C3500453707 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 01308D8513491C3500453707 /* Project object */; } ================================================ FILE: Examples/No Nib Demo/iCarouselNoNibDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: Examples/No Nib Demo/iCarouselNoNibDemo.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings ================================================ IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded ================================================ FILE: Examples/No Nib Demo/main.m ================================================ // // main.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import int main(int argc, char *argv[]) { @autoreleasepool { int retVal = UIApplicationMain(argc, argv, nil, @"iCarouselExampleAppDelegate"); return retVal; } } ================================================ FILE: Examples/Offsets Demo/en.lproj/InfoPlist.strings ================================================ /* Localized versions of Info.plist keys */ ================================================ FILE: Examples/Offsets Demo/en.lproj/MainWindow.xib ================================================ 1024 10D571 786 1038.29 460.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin 112 YES YES com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES YES YES IBFilesOwner IBCocoaTouchFramework IBFirstResponder IBCocoaTouchFramework IBCocoaTouchFramework iCarouselExampleViewController 1 IBCocoaTouchFramework NO 292 {320, 480} 1 MSAxIDEAA NO NO IBCocoaTouchFramework YES YES delegate 4 viewController 11 window 14 YES 0 -1 File's Owner 3 iCarouselExample App Delegate -2 10 12 YES YES -1.CustomClassName -2.CustomClassName 10.CustomClassName 10.IBEditorWindowLastContentRect 10.IBPluginDependency 12.IBEditorWindowLastContentRect 12.IBPluginDependency 3.CustomClassName 3.IBPluginDependency YES UIApplication UIResponder iCarouselExampleViewController {{234, 376}, {320, 480}} com.apple.InterfaceBuilder.IBCocoaTouchPlugin {{525, 346}, {320, 480}} com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarouselExampleAppDelegate com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES YES YES 15 YES UIWindow UIView IBUserSource iCarouselExampleAppDelegate NSObject YES YES viewController window YES iCarouselExampleViewController UIWindow YES YES viewController window YES viewController iCarouselExampleViewController window UIWindow IBProjectSource iCarouselExampleAppDelegate.h iCarouselExampleAppDelegate NSObject IBUserSource iCarouselExampleViewController UIViewController IBProjectSource iCarouselExampleViewController.h YES NSObject IBFrameworkSource Foundation.framework/Headers/NSError.h NSObject IBFrameworkSource Foundation.framework/Headers/NSFileManager.h NSObject IBFrameworkSource Foundation.framework/Headers/NSKeyValueCoding.h NSObject IBFrameworkSource Foundation.framework/Headers/NSKeyValueObserving.h NSObject IBFrameworkSource Foundation.framework/Headers/NSKeyedArchiver.h NSObject IBFrameworkSource Foundation.framework/Headers/NSObject.h NSObject IBFrameworkSource Foundation.framework/Headers/NSRunLoop.h NSObject IBFrameworkSource Foundation.framework/Headers/NSThread.h NSObject IBFrameworkSource Foundation.framework/Headers/NSURL.h NSObject IBFrameworkSource Foundation.framework/Headers/NSURLConnection.h NSObject IBFrameworkSource UIKit.framework/Headers/UIAccessibility.h NSObject IBFrameworkSource UIKit.framework/Headers/UINibLoading.h NSObject IBFrameworkSource UIKit.framework/Headers/UIResponder.h UIApplication UIResponder IBFrameworkSource UIKit.framework/Headers/UIApplication.h UIResponder NSObject UISearchBar UIView IBFrameworkSource UIKit.framework/Headers/UISearchBar.h UISearchDisplayController NSObject IBFrameworkSource UIKit.framework/Headers/UISearchDisplayController.h UIView IBFrameworkSource UIKit.framework/Headers/UITextField.h UIView UIResponder IBFrameworkSource UIKit.framework/Headers/UIView.h UIViewController IBFrameworkSource UIKit.framework/Headers/UINavigationController.h UIViewController IBFrameworkSource UIKit.framework/Headers/UIPopoverController.h UIViewController IBFrameworkSource UIKit.framework/Headers/UISplitViewController.h UIViewController IBFrameworkSource UIKit.framework/Headers/UITabBarController.h UIViewController UIResponder IBFrameworkSource UIKit.framework/Headers/UIViewController.h UIWindow UIView IBFrameworkSource UIKit.framework/Headers/UIWindow.h 0 IBCocoaTouchFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 YES iCarouselExample.xcodeproj 3 112 ================================================ FILE: Examples/Offsets Demo/en.lproj/iCarouselExampleViewController.xib ================================================ 1536 12A206j 2541 1172.1 613.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin 1875 YES IBProxyObject IBUIImageView IBUILabel IBUISlider IBUIView YES com.apple.InterfaceBuilder.IBCocoaTouchPlugin PluginDependencyRecalculationVersion YES IBFilesOwner IBCocoaTouchFramework IBFirstResponder IBCocoaTouchFramework 274 YES 274 {320, 468} NO YES YES IBCocoaTouchFramework NSImage background.png 274 {320, 460} 3 MSAwAA 2 IBCocoaTouchFramework 290 {{9, 5}, {302, 23}} _NS:623 NO IBCocoaTouchFramework 0 0 -300 300 292 {{20, 30}, {113, 21}} _NS:328 NO YES 7 NO IBCocoaTouchFramework 1 10 viewpointOffset 3 MQA 2 15 Helvetica-Bold 15 16 2 289 {{173, 30}, {127, 21}} _NS:328 NO YES 7 NO IBCocoaTouchFramework 1 10 {0,0} 2 2 266 {{9, 431}, {302, 23}} _NS:623 NO IBCocoaTouchFramework 0 0 -300 300 268 {{20, 407}, {112, 21}} _NS:328 NO YES 7 NO IBCocoaTouchFramework 1 10 contentOffset 2 265 {{173, 407}, {127, 21}} _NS:328 NO YES 7 NO IBCocoaTouchFramework 1 10 {0,0} 2 2 {{0, 20}, {320, 460}} 3 MC43NQA NO IBCocoaTouchFramework YES view 7 carousel 9 viewpointOffsetLabel 47 contentOffsetLabel 48 dataSource 10 delegate 11 updateViewpointOffset: 13 45 updateContentOffset: 13 46 YES 0 YES -1 File's Owner -2 6 YES 8 YES iCarousel 21 39 40 41 43 44 42 YES YES -1.CustomClassName -1.IBPluginDependency -2.CustomClassName -2.IBPluginDependency 21.IBPluginDependency 39.IBPluginDependency 40.IBPluginDependency 41.IBPluginDependency 42.IBPluginDependency 43.IBPluginDependency 44.IBPluginDependency 6.IBPluginDependency 8.CustomClassName 8.IBPluginDependency YES iCarouselExampleViewController com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIResponder com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarousel com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES 48 0 IBCocoaTouchFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 YES 3 background.png {50, 468} 1875 ================================================ FILE: Examples/Offsets Demo/iCarouselExample-Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleDisplayName ${PRODUCT_NAME} CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIconFile CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1.0 LSRequiresIPhoneOS NSMainNibFile MainWindow UIStatusBarHidden UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight ================================================ FILE: Examples/Offsets Demo/iCarouselExample-Prefix.pch ================================================ // // Prefix header for all source files of the 'iCarouselExample' target in the 'iCarouselExample' project // #import #ifndef __IPHONE_3_0 #warning "This project uses features only available in iPhone SDK 3.0 and later." #endif #ifdef __OBJC__ #import #import #endif ================================================ FILE: Examples/Offsets Demo/iCarouselExample.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 01308D9313491C3500453707 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9213491C3500453707 /* UIKit.framework */; }; 01308D9513491C3500453707 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9413491C3500453707 /* Foundation.framework */; }; 01308D9713491C3500453707 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9613491C3500453707 /* CoreGraphics.framework */; }; 01308DC013491F7200453707 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308DBF13491F7200453707 /* QuartzCore.framework */; }; 0148358813A36C2000E687AC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358313A36C2000E687AC /* main.m */; }; 0148359313A36C3700E687AC /* iCarouselExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */; }; 0148359413A36C3700E687AC /* iCarouselExampleAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */; }; 0148359513A36C3700E687AC /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0148358F13A36C3700E687AC /* MainWindow.xib */; }; 0148359613A36C3700E687AC /* iCarouselExampleViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */; }; 018AE9BB179E87CB00FB7311 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 018AE9BA179E87CB00FB7311 /* Default-568h@2x.png */; }; B2E5E6C1146145C900EADB7A /* iCarousel.m in Sources */ = {isa = PBXBuildFile; fileRef = B2E5E6C0146145C900EADB7A /* iCarousel.m */; }; B2E5E72D1461544B00EADB7A /* background.png in Resources */ = {isa = PBXBuildFile; fileRef = B2E5E72B1461544B00EADB7A /* background.png */; }; B2E5E72E1461544B00EADB7A /* page.png in Resources */ = {isa = PBXBuildFile; fileRef = B2E5E72C1461544B00EADB7A /* page.png */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 01308D9213491C3500453707 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 01308D9413491C3500453707 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 01308D9613491C3500453707 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 01308DBF13491F7200453707 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 0148358313A36C2000E687AC /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = SOURCE_ROOT; }; 0148358413A36C2000E687AC /* iCarouselExample-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "iCarouselExample-Info.plist"; sourceTree = SOURCE_ROOT; }; 0148358513A36C2000E687AC /* iCarouselExample-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "iCarouselExample-Prefix.pch"; sourceTree = SOURCE_ROOT; }; 0148358713A36C2000E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = SOURCE_ROOT; }; 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleViewController.m; sourceTree = SOURCE_ROOT; }; 0148358C13A36C3700E687AC /* iCarouselExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleViewController.h; sourceTree = SOURCE_ROOT; }; 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleAppDelegate.m; sourceTree = SOURCE_ROOT; }; 0148358E13A36C3700E687AC /* iCarouselExampleAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleAppDelegate.h; sourceTree = SOURCE_ROOT; }; 0148359013A36C3700E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainWindow.xib; sourceTree = SOURCE_ROOT; }; 0148359213A36C3700E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/iCarouselExampleViewController.xib; sourceTree = SOURCE_ROOT; }; 018AE9BA179E87CB00FB7311 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = SOURCE_ROOT; }; 018BBCB413A375AF005CA505 /* iCarouselExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iCarouselExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; B2E5E6BF146145C900EADB7A /* iCarousel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarousel.h; sourceTree = ""; }; B2E5E6C0146145C900EADB7A /* iCarousel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarousel.m; sourceTree = ""; }; B2E5E72B1461544B00EADB7A /* background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = background.png; path = ../Resources/background.png; sourceTree = SOURCE_ROOT; }; B2E5E72C1461544B00EADB7A /* page.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = page.png; path = ../Resources/page.png; sourceTree = SOURCE_ROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 01308D8B13491C3500453707 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 01308DC013491F7200453707 /* QuartzCore.framework in Frameworks */, 01308D9313491C3500453707 /* UIKit.framework in Frameworks */, 01308D9513491C3500453707 /* Foundation.framework in Frameworks */, 01308D9713491C3500453707 /* CoreGraphics.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 01308D8313491C3500453707 = { isa = PBXGroup; children = ( B2E5E6BE146145C900EADB7A /* iCarousel */, 01308D9813491C3500453707 /* iCarouselExample */, 01308D9113491C3500453707 /* Frameworks */, 01308D8F13491C3500453707 /* Products */, ); sourceTree = ""; }; 01308D8F13491C3500453707 /* Products */ = { isa = PBXGroup; children = ( 018BBCB413A375AF005CA505 /* iCarouselExample.app */, ); name = Products; sourceTree = ""; }; 01308D9113491C3500453707 /* Frameworks */ = { isa = PBXGroup; children = ( 01308DBF13491F7200453707 /* QuartzCore.framework */, 01308D9213491C3500453707 /* UIKit.framework */, 01308D9413491C3500453707 /* Foundation.framework */, 01308D9613491C3500453707 /* CoreGraphics.framework */, ); name = Frameworks; sourceTree = ""; }; 01308D9813491C3500453707 /* iCarouselExample */ = { isa = PBXGroup; children = ( 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */, 0148358C13A36C3700E687AC /* iCarouselExampleViewController.h */, 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */, 0148358E13A36C3700E687AC /* iCarouselExampleAppDelegate.h */, 0148358F13A36C3700E687AC /* MainWindow.xib */, 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */, B2E5E72A1461543E00EADB7A /* Resources */, 01308D9913491C3500453707 /* Supporting Files */, ); path = iCarouselExample; sourceTree = ""; }; 01308D9913491C3500453707 /* Supporting Files */ = { isa = PBXGroup; children = ( 0148358313A36C2000E687AC /* main.m */, 018AE9BA179E87CB00FB7311 /* Default-568h@2x.png */, 0148358413A36C2000E687AC /* iCarouselExample-Info.plist */, 0148358513A36C2000E687AC /* iCarouselExample-Prefix.pch */, 0148358613A36C2000E687AC /* InfoPlist.strings */, ); name = "Supporting Files"; sourceTree = ""; }; B2E5E6BE146145C900EADB7A /* iCarousel */ = { isa = PBXGroup; children = ( B2E5E6BF146145C900EADB7A /* iCarousel.h */, B2E5E6C0146145C900EADB7A /* iCarousel.m */, ); name = iCarousel; path = ../../iCarousel; sourceTree = ""; }; B2E5E72A1461543E00EADB7A /* Resources */ = { isa = PBXGroup; children = ( B2E5E72B1461544B00EADB7A /* background.png */, B2E5E72C1461544B00EADB7A /* page.png */, ); name = Resources; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 01308D8D13491C3500453707 /* iCarouselExample */ = { isa = PBXNativeTarget; buildConfigurationList = 01308DAF13491C3500453707 /* Build configuration list for PBXNativeTarget "iCarouselExample" */; buildPhases = ( 01308D8A13491C3500453707 /* Sources */, 01308D8B13491C3500453707 /* Frameworks */, 01308D8C13491C3500453707 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = iCarouselExample; productName = iCarouselExample; productReference = 018BBCB413A375AF005CA505 /* iCarouselExample.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 01308D8513491C3500453707 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0800; }; buildConfigurationList = 01308D8813491C3500453707 /* Build configuration list for PBXProject "iCarouselExample" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); mainGroup = 01308D8313491C3500453707; productRefGroup = 01308D8F13491C3500453707 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 01308D8D13491C3500453707 /* iCarouselExample */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 01308D8C13491C3500453707 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 0148359513A36C3700E687AC /* MainWindow.xib in Resources */, 0148359613A36C3700E687AC /* iCarouselExampleViewController.xib in Resources */, B2E5E72D1461544B00EADB7A /* background.png in Resources */, B2E5E72E1461544B00EADB7A /* page.png in Resources */, 018AE9BB179E87CB00FB7311 /* Default-568h@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 01308D8A13491C3500453707 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 0148358813A36C2000E687AC /* main.m in Sources */, 0148359313A36C3700E687AC /* iCarouselExampleViewController.m in Sources */, 0148359413A36C3700E687AC /* iCarouselExampleAppDelegate.m in Sources */, B2E5E6C1146145C900EADB7A /* iCarousel.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 0148358613A36C2000E687AC /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( 0148358713A36C2000E687AC /* en */, ); name = InfoPlist.strings; sourceTree = ""; }; 0148358F13A36C3700E687AC /* MainWindow.xib */ = { isa = PBXVariantGroup; children = ( 0148359013A36C3700E687AC /* en */, ); name = MainWindow.xib; sourceTree = ""; }; 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */ = { isa = PBXVariantGroup; children = ( 0148359213A36C3700E687AC /* en */, ); name = iCarouselExampleViewController.xib; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 01308DAD13491C3500453707 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = DEBUG; GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; }; name = Debug; }; 01308DAE13491C3500453707 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; SDKROOT = iphoneos; }; name = Release; }; 01308DB013491C3500453707 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselExample-Prefix.pch"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = "iCarouselExample-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = iCarouselExample; TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = app; }; name = Debug; }; 01308DB113491C3500453707 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselExample-Prefix.pch"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = "iCarouselExample-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = iCarouselExample; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; WRAPPER_EXTENSION = app; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 01308D8813491C3500453707 /* Build configuration list for PBXProject "iCarouselExample" */ = { isa = XCConfigurationList; buildConfigurations = ( 01308DAD13491C3500453707 /* Debug */, 01308DAE13491C3500453707 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 01308DAF13491C3500453707 /* Build configuration list for PBXNativeTarget "iCarouselExample" */ = { isa = XCConfigurationList; buildConfigurations = ( 01308DB013491C3500453707 /* Debug */, 01308DB113491C3500453707 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 01308D8513491C3500453707 /* Project object */; } ================================================ FILE: Examples/Offsets Demo/iCarouselExampleAppDelegate.h ================================================ // // iCarouselExampleAppDelegate.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import @class iCarouselExampleViewController; @interface iCarouselExampleAppDelegate : NSObject @property (nonatomic, strong) IBOutlet UIWindow *window; @property (nonatomic, strong) IBOutlet iCarouselExampleViewController *viewController; @end ================================================ FILE: Examples/Offsets Demo/iCarouselExampleAppDelegate.m ================================================ // // iCarouselExampleAppDelegate.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleAppDelegate.h" #import "iCarouselExampleViewController.h" @implementation iCarouselExampleAppDelegate @synthesize window; @synthesize viewController; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { window.rootViewController = viewController; [window makeKeyAndVisible]; return YES; } @end ================================================ FILE: Examples/Offsets Demo/iCarouselExampleViewController.h ================================================ // // iCarouselExampleViewController.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import #import "iCarousel.h" @interface iCarouselExampleViewController : UIViewController @property (nonatomic, strong) IBOutlet iCarousel *carousel; @property (nonatomic, unsafe_unretained) IBOutlet UILabel *viewpointOffsetLabel; @property (nonatomic, unsafe_unretained) IBOutlet UILabel *contentOffsetLabel; - (IBAction)updateViewpointOffset:(UISlider *)slider; - (IBAction)updateContentOffset:(UISlider *)slider; @end ================================================ FILE: Examples/Offsets Demo/iCarouselExampleViewController.m ================================================ // // iCarouselExampleViewController.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleViewController.h" @interface iCarouselExampleViewController () @property (nonatomic, strong) NSMutableArray *items; @end @implementation iCarouselExampleViewController @synthesize contentOffsetLabel; @synthesize viewpointOffsetLabel; @synthesize carousel; @synthesize items; - (void)setUp { //set up data self.items = [NSMutableArray array]; for (int i = 0; i < 1000; i++) { [items addObject:@(i)]; } } - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { [self setUp]; } return self; } - (id)initWithCoder:(NSCoder *)aDecoder { if ((self = [super initWithCoder:aDecoder])) { [self setUp]; } return self; } - (void)dealloc { //it's a good idea to set these to nil here to avoid //sending messages to a deallocated viewcontroller carousel.delegate = nil; carousel.dataSource = nil; } #pragma mark - #pragma mark View lifecycle - (void)viewDidLoad { [super viewDidLoad]; //configure carousel carousel.type = iCarouselTypeCylinder; } - (void)viewDidUnload { [super viewDidUnload]; self.carousel = nil; } - (IBAction)updateViewpointOffset:(UISlider *)slider { CGSize offset = CGSizeMake(0.0f, slider.value); carousel.viewpointOffset = offset; viewpointOffsetLabel.text = NSStringFromCGSize(offset); } - (IBAction)updateContentOffset:(UISlider *)slider { CGSize offset = CGSizeMake(0.0f, slider.value); carousel.contentOffset = offset; contentOffsetLabel.text = NSStringFromCGSize(offset); } #pragma mark - #pragma mark iCarousel methods - (NSInteger)numberOfItemsInCarousel:(iCarousel *)carousel { return [items count]; } - (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view { UILabel *label = nil; //create new view if no view is available for recycling if (view == nil) { view = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 200.0f, 200.0f)]; ((UIImageView *)view).image = [UIImage imageNamed:@"page.png"]; view.contentMode = UIViewContentModeCenter; label = [[UILabel alloc] initWithFrame:view.bounds]; label.backgroundColor = [UIColor clearColor]; label.textAlignment = NSTextAlignmentCenter; label.font = [label.font fontWithSize:50]; label.tag = 1; [view addSubview:label]; } else { //get a reference to the label in the recycled view label = (UILabel *)[view viewWithTag:1]; } //set item label //remember to always set any properties of your carousel item //views outside of the `if (view == nil) {...}` check otherwise //you'll get weird issues with carousel item content appearing //in the wrong place in the carousel label.text = [items[index] stringValue]; return view; } - (CGFloat)carousel:(iCarousel *)_carousel valueForOption:(iCarouselOption)option withDefault:(CGFloat)value { //customize carousel display switch (option) { case iCarouselOptionSpacing: { //add a bit of spacing between the item views return value * 1.05f; } default: { return value; } } } @end ================================================ FILE: Examples/Offsets Demo/main.m ================================================ // // main.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import int main(int argc, char *argv[]) { @autoreleasepool { int retVal = UIApplicationMain(argc, argv, nil, nil); return retVal; } } ================================================ FILE: Examples/Options Demo/en.lproj/InfoPlist.strings ================================================ /* Localized versions of Info.plist keys */ ================================================ FILE: Examples/Options Demo/en.lproj/MainWindow.xib ================================================ ================================================ FILE: Examples/Options Demo/en.lproj/iCarouselExampleViewController.xib ================================================ 1536 12A206j 2541 1172.1 613.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin 1875 YES IBProxyObject IBUIBarButtonItem IBUIImageView IBUILabel IBUINavigationBar IBUINavigationItem IBUISlider IBUIToolbar IBUIView YES com.apple.InterfaceBuilder.IBCocoaTouchPlugin PluginDependencyRecalculationVersion YES IBFilesOwner IBCocoaTouchFramework IBFirstResponder IBCocoaTouchFramework 274 YES 274 {320, 468} NO YES YES IBCocoaTouchFramework NSImage background.png 274 {{0, 186}, {320, 230}} 3 MSAwAA 2 IBCocoaTouchFramework 266 {{0, 416}, {320, 44}} NO NO IBCocoaTouchFramework YES Switch Type IBCocoaTouchFramework 1 IBCocoaTouchFramework 5 Horizontal IBCocoaTouchFramework 80 1 Wrap: ON IBCocoaTouchFramework 80 1 290 {320, 44} IBCocoaTouchFramework YES Insert Item IBCocoaTouchFramework 1 Delete Item IBCocoaTouchFramework 1 IBCocoaTouchFramework 292 {{92, 87}, {210, 23}} _NS:623 NO IBCocoaTouchFramework 0 0 1 0.0010000000474974513 2 292 {{20, 87}, {53, 21}} _NS:328 NO YES 7 NO IBCocoaTouchFramework 1 10 Radius 1 MCAwIDAAA 1 17 Helvetica 17 16 2 292 {{92, 55}, {210, 23}} _NS:623 NO IBCocoaTouchFramework 0 0 1 0.0010000000474974513 292 {{20, 54}, {53, 21}} _NS:328 NO YES 7 NO IBCocoaTouchFramework 1 10 Arc 2 292 {{92, 118}, {210, 23}} _NS:623 NO IBCocoaTouchFramework 0 0 0.89999997615814209 0.0010000000474974513 292 {{20, 117}, {53, 21}} _NS:328 NO YES 7 NO IBCocoaTouchFramework 1 10 Tilt 2 292 {{92, 149}, {210, 23}} _NS:623 NO IBCocoaTouchFramework 0 0 1 0.0010000000474974513 2 292 {{20, 148}, {63, 21}} _NS:328 NO YES 7 NO IBCocoaTouchFramework 1 10 Spacing 2 {{0, 20}, {320, 460}} 3 MC43NQA NO IBCocoaTouchFramework YES view 7 carousel 9 navItem 20 orientationBarItem 36 wrapBarItem 37 radiusSlider 44 spacingSlider 45 tiltSlider 46 arcSlider 53 dataSource 10 delegate 11 switchCarouselType 18 toggleWrap 23 insertItem 28 removeItem 30 toggleOrientation 34 reloadCarousel 13 47 reloadCarousel 13 48 reloadCarousel 13 49 reloadCarousel 13 54 YES 0 YES -1 File's Owner -2 6 YES 8 YES iCarousel 15 YES 16 YES 21 24 YES 27 17 25 22 26 31 38 39 40 41 42 43 50 51 YES YES -1.CustomClassName -1.IBPluginDependency -2.CustomClassName -2.IBPluginDependency 15.IBPluginDependency 16.IBPluginDependency 17.IBPluginDependency 21.IBPluginDependency 22.IBPluginDependency 24.IBPluginDependency 25.IBPluginDependency 26.IBPluginDependency 27.IBPluginDependency 31.IBPluginDependency 38.IBPluginDependency 39.IBPluginDependency 40.IBPluginDependency 41.IBPluginDependency 42.IBPluginDependency 43.IBPluginDependency 50.IBPluginDependency 51.IBPluginDependency 6.IBPluginDependency 8.CustomClassName 8.IBPluginDependency YES iCarouselExampleViewController com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIResponder com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarousel com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES 54 YES iCarousel UIView YES YES dataSource delegate YES id id YES YES dataSource delegate YES dataSource id delegate id IBProjectSource ./Classes/iCarousel.h iCarouselExampleViewController UIViewController YES YES insertItem reloadCarousel removeItem switchCarouselType toggleOrientation toggleWrap YES id id id id id id YES YES insertItem reloadCarousel removeItem switchCarouselType toggleOrientation toggleWrap YES insertItem id reloadCarousel id removeItem id switchCarouselType id toggleOrientation id toggleWrap id YES YES arcSlider carousel navItem orientationBarItem radiusSlider spacingSlider tiltSlider wrapBarItem YES UISlider iCarousel UINavigationItem UIBarItem UISlider UISlider UISlider UIBarItem YES YES arcSlider carousel navItem orientationBarItem radiusSlider spacingSlider tiltSlider wrapBarItem YES arcSlider UISlider carousel iCarousel navItem UINavigationItem orientationBarItem UIBarItem radiusSlider UISlider spacingSlider UISlider tiltSlider UISlider wrapBarItem UIBarItem IBProjectSource ./Classes/iCarouselExampleViewController.h 0 IBCocoaTouchFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 YES 3 background.png {50, 468} 1875 ================================================ FILE: Examples/Options Demo/iCarouselExample-Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleDisplayName ${PRODUCT_NAME} CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIconFile CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1.0 LSRequiresIPhoneOS NSMainNibFile MainWindow UIStatusBarHidden UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight ================================================ FILE: Examples/Options Demo/iCarouselExample-Prefix.pch ================================================ // // Prefix header for all source files of the 'iCarouselExample' target in the 'iCarouselExample' project // #import #ifndef __IPHONE_3_0 #warning "This project uses features only available in iPhone SDK 3.0 and later." #endif #ifdef __OBJC__ #import #import #endif ================================================ FILE: Examples/Options Demo/iCarouselExampleAppDelegate.h ================================================ // // iCarouselExampleAppDelegate.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import @class iCarouselExampleViewController; @interface iCarouselExampleAppDelegate : NSObject @property (nonatomic, strong) IBOutlet UIWindow *window; @property (nonatomic, strong) IBOutlet iCarouselExampleViewController *viewController; @end ================================================ FILE: Examples/Options Demo/iCarouselExampleAppDelegate.m ================================================ // // iCarouselExampleAppDelegate.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleAppDelegate.h" #import "iCarouselExampleViewController.h" @implementation iCarouselExampleAppDelegate @synthesize window; @synthesize viewController; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [window addSubview:viewController.view]; [window makeKeyAndVisible]; return YES; } @end ================================================ FILE: Examples/Options Demo/iCarouselExampleViewController.h ================================================ // // iCarouselExampleViewController.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import #import "iCarousel.h" @interface iCarouselExampleViewController : UIViewController @property (nonatomic, strong) IBOutlet iCarousel *carousel; @property (nonatomic, strong) IBOutlet UINavigationItem *navItem; @property (nonatomic, strong) IBOutlet UIBarItem *orientationBarItem; @property (nonatomic, strong) IBOutlet UIBarItem *wrapBarItem; @property (nonatomic, strong) IBOutlet UISlider *arcSlider; @property (nonatomic, strong) IBOutlet UISlider *radiusSlider; @property (nonatomic, strong) IBOutlet UISlider *tiltSlider; @property (nonatomic, strong) IBOutlet UISlider *spacingSlider; - (IBAction)switchCarouselType; - (IBAction)toggleOrientation; - (IBAction)toggleWrap; - (IBAction)insertItem; - (IBAction)removeItem; - (IBAction)reloadCarousel; @end ================================================ FILE: Examples/Options Demo/iCarouselExampleViewController.m ================================================ // // iCarouselExampleViewController.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleViewController.h" @interface iCarouselExampleViewController () @property (nonatomic, assign) BOOL wrap; @property (nonatomic, strong) NSMutableArray *items; @end @implementation iCarouselExampleViewController - (void)setUp { //set up data _wrap = YES; self.items = [NSMutableArray array]; for (int i = 0; i < 1000; i++) { [_items addObject:@(i)]; } } - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { [self setUp]; } return self; } - (id)initWithCoder:(NSCoder *)aDecoder { if ((self = [super initWithCoder:aDecoder])) { [self setUp]; } return self; } - (void)dealloc { //it's a good idea to set these to nil here to avoid //sending messages to a deallocated viewcontroller _carousel.delegate = nil; _carousel.dataSource = nil; } #pragma mark - #pragma mark View lifecycle - (void)updateSliders { switch (_carousel.type) { case iCarouselTypeLinear: { _arcSlider.enabled = NO; _radiusSlider.enabled = NO; _tiltSlider.enabled = NO; _spacingSlider.enabled = YES; break; } case iCarouselTypeCylinder: case iCarouselTypeInvertedCylinder: case iCarouselTypeRotary: case iCarouselTypeInvertedRotary: case iCarouselTypeWheel: case iCarouselTypeInvertedWheel: { _arcSlider.enabled = YES; _radiusSlider.enabled = YES; _tiltSlider.enabled = NO; _spacingSlider.enabled = YES; break; } default: { _arcSlider.enabled = NO; _radiusSlider.enabled = NO; _tiltSlider.enabled = YES; _spacingSlider.enabled = YES; break; } } } - (void)viewDidLoad { [super viewDidLoad]; //configure carousel _carousel.type = iCarouselTypeCoverFlow2; [self updateSliders]; _navItem.title = @"CoverFlow2"; } - (void)viewDidUnload { [super viewDidUnload]; self.carousel = nil; self.navItem = nil; self.orientationBarItem = nil; self.wrapBarItem = nil; self.arcSlider = nil; self.radiusSlider = nil; self.tiltSlider = nil; self.spacingSlider = nil; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } - (IBAction)switchCarouselType { UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@"Select Carousel Type" delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:@"Linear", @"Rotary", @"Inverted Rotary", @"Cylinder", @"Inverted Cylinder", @"Wheel", @"Inverted Wheel", @"CoverFlow", @"CoverFlow2", @"Time Machine", @"Inverted Time Machine", nil]; [sheet showInView:self.view]; } - (IBAction)toggleOrientation { //carousel orientation can be animated [UIView beginAnimations:nil context:nil]; _carousel.vertical = !_carousel.vertical; [UIView commitAnimations]; //update button _orientationBarItem.title = _carousel.vertical? @"Vertical": @"Horizontal"; } - (IBAction)toggleWrap { _wrap = !_wrap; _wrapBarItem.title = _wrap? @"Wrap: ON": @"Wrap: OFF"; [_carousel reloadData]; } - (IBAction)insertItem { NSInteger index = MAX(0, _carousel.currentItemIndex); [_items insertObject:@(_carousel.numberOfItems) atIndex:index]; [_carousel insertItemAtIndex:index animated:YES]; } - (IBAction)removeItem { if (_carousel.numberOfItems > 0) { NSInteger index = _carousel.currentItemIndex; [_carousel removeItemAtIndex:index animated:YES]; [_items removeObjectAtIndex:index]; } } - (IBAction)reloadCarousel { [_carousel reloadData]; } #pragma mark - #pragma mark UIActionSheet methods - (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex { if (buttonIndex >= 0) { //map button index to carousel type iCarouselType type = buttonIndex; //carousel can smoothly animate between types [UIView beginAnimations:nil context:nil]; _carousel.type = type; [self updateSliders]; [UIView commitAnimations]; //update title _navItem.title = [actionSheet buttonTitleAtIndex:buttonIndex]; } } #pragma mark - #pragma mark iCarousel methods - (NSInteger)numberOfItemsInCarousel:(iCarousel *)carousel { return [_items count]; } - (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view { UILabel *label = nil; //create new view if no view is available for recycling if (view == nil) { view = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 200.0f, 200.0f)]; ((UIImageView *)view).image = [UIImage imageNamed:@"page.png"]; view.contentMode = UIViewContentModeCenter; label = [[UILabel alloc] initWithFrame:view.bounds]; label.backgroundColor = [UIColor clearColor]; label.textAlignment = NSTextAlignmentCenter; label.font = [label.font fontWithSize:50]; label.tag = 1; [view addSubview:label]; } else { //get a reference to the label in the recycled view label = (UILabel *)[view viewWithTag:1]; } //set item label //remember to always set any properties of your carousel item //views outside of the `if (view == nil) {...}` check otherwise //you'll get weird issues with carousel item content appearing //in the wrong place in the carousel label.text = [_items[index] stringValue]; return view; } - (CGFloat)carousel:(iCarousel *)carousel valueForOption:(iCarouselOption)option withDefault:(CGFloat)value { switch (option) { case iCarouselOptionWrap: { return _wrap; } case iCarouselOptionFadeMax: { if (carousel.type == iCarouselTypeCustom) { return 0.0f; } return value; } case iCarouselOptionArc: { return 2 * M_PI * _arcSlider.value; } case iCarouselOptionRadius: { return value * _radiusSlider.value; } case iCarouselOptionTilt: { return _tiltSlider.value; } case iCarouselOptionSpacing: { return value * _spacingSlider.value; } default: { return value; } } } @end ================================================ FILE: Examples/Options Demo/iCarouselOptionsDemo.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 01308D9313491C3500453707 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9213491C3500453707 /* UIKit.framework */; }; 01308D9513491C3500453707 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9413491C3500453707 /* Foundation.framework */; }; 01308D9713491C3500453707 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9613491C3500453707 /* CoreGraphics.framework */; }; 01308DC013491F7200453707 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308DBF13491F7200453707 /* QuartzCore.framework */; }; 0148358813A36C2000E687AC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358313A36C2000E687AC /* main.m */; }; 0148359313A36C3700E687AC /* iCarouselExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */; }; 0148359413A36C3700E687AC /* iCarouselExampleAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */; }; 0148359513A36C3700E687AC /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0148358F13A36C3700E687AC /* MainWindow.xib */; }; 0148359613A36C3700E687AC /* iCarouselExampleViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */; }; 018AE9BD179E8F8800FB7311 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 018AE9BC179E8F8800FB7311 /* Default-568h@2x.png */; }; B2E5E6C1146145C900EADB7A /* iCarousel.m in Sources */ = {isa = PBXBuildFile; fileRef = B2E5E6C0146145C900EADB7A /* iCarousel.m */; }; B2E5E72D1461544B00EADB7A /* background.png in Resources */ = {isa = PBXBuildFile; fileRef = B2E5E72B1461544B00EADB7A /* background.png */; }; B2E5E72E1461544B00EADB7A /* page.png in Resources */ = {isa = PBXBuildFile; fileRef = B2E5E72C1461544B00EADB7A /* page.png */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 01308D9213491C3500453707 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 01308D9413491C3500453707 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 01308D9613491C3500453707 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 01308DBF13491F7200453707 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 0148358313A36C2000E687AC /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = SOURCE_ROOT; }; 0148358413A36C2000E687AC /* iCarouselExample-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "iCarouselExample-Info.plist"; sourceTree = SOURCE_ROOT; }; 0148358513A36C2000E687AC /* iCarouselExample-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "iCarouselExample-Prefix.pch"; sourceTree = SOURCE_ROOT; }; 0148358713A36C2000E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = SOURCE_ROOT; }; 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleViewController.m; sourceTree = SOURCE_ROOT; }; 0148358C13A36C3700E687AC /* iCarouselExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleViewController.h; sourceTree = SOURCE_ROOT; }; 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleAppDelegate.m; sourceTree = SOURCE_ROOT; }; 0148358E13A36C3700E687AC /* iCarouselExampleAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleAppDelegate.h; sourceTree = SOURCE_ROOT; }; 0148359013A36C3700E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainWindow.xib; sourceTree = SOURCE_ROOT; }; 0148359213A36C3700E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/iCarouselExampleViewController.xib; sourceTree = SOURCE_ROOT; }; 018AE9BC179E8F8800FB7311 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = SOURCE_ROOT; }; 018BBCB413A375AF005CA505 /* iCarouselOptionsDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iCarouselOptionsDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; B2E5E6BF146145C900EADB7A /* iCarousel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarousel.h; sourceTree = ""; }; B2E5E6C0146145C900EADB7A /* iCarousel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarousel.m; sourceTree = ""; }; B2E5E72B1461544B00EADB7A /* background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = background.png; path = ../Resources/background.png; sourceTree = SOURCE_ROOT; }; B2E5E72C1461544B00EADB7A /* page.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = page.png; path = ../Resources/page.png; sourceTree = SOURCE_ROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 01308D8B13491C3500453707 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 01308DC013491F7200453707 /* QuartzCore.framework in Frameworks */, 01308D9313491C3500453707 /* UIKit.framework in Frameworks */, 01308D9513491C3500453707 /* Foundation.framework in Frameworks */, 01308D9713491C3500453707 /* CoreGraphics.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 01308D8313491C3500453707 = { isa = PBXGroup; children = ( B2E5E6BE146145C900EADB7A /* iCarousel */, 01308D9813491C3500453707 /* iCarouselOptionsDemo */, 01308D9113491C3500453707 /* Frameworks */, 01308D8F13491C3500453707 /* Products */, ); sourceTree = ""; }; 01308D8F13491C3500453707 /* Products */ = { isa = PBXGroup; children = ( 018BBCB413A375AF005CA505 /* iCarouselOptionsDemo.app */, ); name = Products; sourceTree = ""; }; 01308D9113491C3500453707 /* Frameworks */ = { isa = PBXGroup; children = ( 01308DBF13491F7200453707 /* QuartzCore.framework */, 01308D9213491C3500453707 /* UIKit.framework */, 01308D9413491C3500453707 /* Foundation.framework */, 01308D9613491C3500453707 /* CoreGraphics.framework */, ); name = Frameworks; sourceTree = ""; }; 01308D9813491C3500453707 /* iCarouselOptionsDemo */ = { isa = PBXGroup; children = ( 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */, 0148358C13A36C3700E687AC /* iCarouselExampleViewController.h */, 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */, 0148358E13A36C3700E687AC /* iCarouselExampleAppDelegate.h */, 0148358F13A36C3700E687AC /* MainWindow.xib */, 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */, B2E5E72A1461543E00EADB7A /* Resources */, 01308D9913491C3500453707 /* Supporting Files */, ); path = iCarouselOptionsDemo; sourceTree = ""; }; 01308D9913491C3500453707 /* Supporting Files */ = { isa = PBXGroup; children = ( 018AE9BC179E8F8800FB7311 /* Default-568h@2x.png */, 0148358313A36C2000E687AC /* main.m */, 0148358413A36C2000E687AC /* iCarouselExample-Info.plist */, 0148358513A36C2000E687AC /* iCarouselExample-Prefix.pch */, 0148358613A36C2000E687AC /* InfoPlist.strings */, ); name = "Supporting Files"; sourceTree = ""; }; B2E5E6BE146145C900EADB7A /* iCarousel */ = { isa = PBXGroup; children = ( B2E5E6BF146145C900EADB7A /* iCarousel.h */, B2E5E6C0146145C900EADB7A /* iCarousel.m */, ); name = iCarousel; path = ../../iCarousel; sourceTree = ""; }; B2E5E72A1461543E00EADB7A /* Resources */ = { isa = PBXGroup; children = ( B2E5E72B1461544B00EADB7A /* background.png */, B2E5E72C1461544B00EADB7A /* page.png */, ); name = Resources; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 01308D8D13491C3500453707 /* iCarouselOptionsDemo */ = { isa = PBXNativeTarget; buildConfigurationList = 01308DAF13491C3500453707 /* Build configuration list for PBXNativeTarget "iCarouselOptionsDemo" */; buildPhases = ( 01308D8A13491C3500453707 /* Sources */, 01308D8B13491C3500453707 /* Frameworks */, 01308D8C13491C3500453707 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = iCarouselOptionsDemo; productName = iCarouselOptionsDemo; productReference = 018BBCB413A375AF005CA505 /* iCarouselOptionsDemo.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 01308D8513491C3500453707 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0800; }; buildConfigurationList = 01308D8813491C3500453707 /* Build configuration list for PBXProject "iCarouselOptionsDemo" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); mainGroup = 01308D8313491C3500453707; productRefGroup = 01308D8F13491C3500453707 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 01308D8D13491C3500453707 /* iCarouselOptionsDemo */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 01308D8C13491C3500453707 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 0148359513A36C3700E687AC /* MainWindow.xib in Resources */, 0148359613A36C3700E687AC /* iCarouselExampleViewController.xib in Resources */, B2E5E72D1461544B00EADB7A /* background.png in Resources */, B2E5E72E1461544B00EADB7A /* page.png in Resources */, 018AE9BD179E8F8800FB7311 /* Default-568h@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 01308D8A13491C3500453707 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 0148358813A36C2000E687AC /* main.m in Sources */, 0148359313A36C3700E687AC /* iCarouselExampleViewController.m in Sources */, 0148359413A36C3700E687AC /* iCarouselExampleAppDelegate.m in Sources */, B2E5E6C1146145C900EADB7A /* iCarousel.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 0148358613A36C2000E687AC /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( 0148358713A36C2000E687AC /* en */, ); name = InfoPlist.strings; sourceTree = ""; }; 0148358F13A36C3700E687AC /* MainWindow.xib */ = { isa = PBXVariantGroup; children = ( 0148359013A36C3700E687AC /* en */, ); name = MainWindow.xib; sourceTree = ""; }; 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */ = { isa = PBXVariantGroup; children = ( 0148359213A36C3700E687AC /* en */, ); name = iCarouselExampleViewController.xib; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 01308DAD13491C3500453707 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = DEBUG; GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; }; name = Debug; }; 01308DAE13491C3500453707 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; SDKROOT = iphoneos; }; name = Release; }; 01308DB013491C3500453707 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselExample-Prefix.pch"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = "iCarouselExample-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = iCarouselOptionsDemo; TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = app; }; name = Debug; }; 01308DB113491C3500453707 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselExample-Prefix.pch"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = "iCarouselExample-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = iCarouselOptionsDemo; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; WRAPPER_EXTENSION = app; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 01308D8813491C3500453707 /* Build configuration list for PBXProject "iCarouselOptionsDemo" */ = { isa = XCConfigurationList; buildConfigurations = ( 01308DAD13491C3500453707 /* Debug */, 01308DAE13491C3500453707 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 01308DAF13491C3500453707 /* Build configuration list for PBXNativeTarget "iCarouselOptionsDemo" */ = { isa = XCConfigurationList; buildConfigurations = ( 01308DB013491C3500453707 /* Debug */, 01308DB113491C3500453707 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 01308D8513491C3500453707 /* Project object */; } ================================================ FILE: Examples/Options Demo/iCarouselOptionsDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: Examples/Options Demo/iCarouselOptionsDemo.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings ================================================ IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded ================================================ FILE: Examples/Options Demo/main.m ================================================ // // main.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import int main(int argc, char *argv[]) { @autoreleasepool { int retVal = UIApplicationMain(argc, argv, nil, nil); return retVal; } } ================================================ FILE: Examples/Paging Example/en.lproj/InfoPlist.strings ================================================ /* Localized versions of Info.plist keys */ ================================================ FILE: Examples/Paging Example/en.lproj/MainWindow.xib ================================================ 1552 12C3012 3084 1187.34 625.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin 2083 YES IBProxyObject IBUICustomObject IBUIViewController YES com.apple.InterfaceBuilder.IBCocoaTouchPlugin PluginDependencyRecalculationVersion YES IBFilesOwner IBCocoaTouchFramework IBFirstResponder IBCocoaTouchFramework IBCocoaTouchFramework iCarouselExampleViewController 1 1 IBCocoaTouchFramework NO YES delegate 4 viewController 11 YES 0 YES -1 File's Owner 3 iCarouselExample App Delegate -2 10 YES YES -1.CustomClassName -1.IBPluginDependency -2.CustomClassName -2.IBPluginDependency 10.CustomClassName 10.IBPluginDependency 3.CustomClassName 3.IBPluginDependency YES UIApplication com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIResponder com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarouselExampleViewController com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarouselExampleAppDelegate com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES 16 YES iCarousel UIView YES YES dataSource delegate YES id id YES YES dataSource delegate YES dataSource id delegate id IBProjectSource ./Classes/iCarousel.h iCarouselExampleAppDelegate NSObject YES YES viewController window YES iCarouselExampleViewController UIWindow YES YES viewController window YES viewController iCarouselExampleViewController window UIWindow IBProjectSource ./Classes/iCarouselExampleAppDelegate.h iCarouselExampleViewController UIViewController carousel iCarousel carousel carousel iCarousel IBProjectSource ./Classes/iCarouselExampleViewController.h 0 IBCocoaTouchFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 YES 3 2083 ================================================ FILE: Examples/Paging Example/en.lproj/iCarouselExampleViewController.xib ================================================ 1552 12E55 3084 1187.39 626.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin 2083 YES IBProxyObject IBUIView YES com.apple.InterfaceBuilder.IBCocoaTouchPlugin PluginDependencyRecalculationVersion YES IBFilesOwner IBCocoaTouchFramework IBFirstResponder IBCocoaTouchFramework 274 YES 274 {320, 460} 3 MSAwAA 2 IBCocoaTouchFramework {{0, 20}, {320, 460}} 3 MC43NQA NO IBCocoaTouchFramework YES view 7 carousel 9 dataSource 10 delegate 11 YES 0 YES -1 File's Owner -2 6 YES 8 iCarousel YES YES -1.CustomClassName -1.IBPluginDependency -2.CustomClassName -2.IBPluginDependency 6.IBPluginDependency 8.CustomClassName 8.IBPluginDependency YES iCarouselExampleViewController com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIResponder com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarousel com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES 37 YES iCarousel UIView YES YES dataSource delegate YES id id YES YES dataSource delegate YES dataSource id delegate id IBProjectSource ./Classes/iCarousel.h iCarouselExampleViewController UIViewController carousel iCarousel carousel carousel iCarousel IBProjectSource ./Classes/iCarouselExampleViewController.h 0 IBCocoaTouchFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 YES 3 2083 ================================================ FILE: Examples/Paging Example/iCarouselExample-Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleDisplayName ${PRODUCT_NAME} CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIconFile CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1.0 LSRequiresIPhoneOS NSMainNibFile MainWindow UIStatusBarHidden UISupportedInterfaceOrientations UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight ================================================ FILE: Examples/Paging Example/iCarouselExample-Prefix.pch ================================================ // // Prefix header for all source files of the 'iCarouselExample' target in the 'iCarouselExample' project // #import #ifndef __IPHONE_3_0 #warning "This project uses features only available in iPhone SDK 3.0 and later." #endif #ifdef __OBJC__ #import #import #endif ================================================ FILE: Examples/Paging Example/iCarouselExample.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 01308D9313491C3500453707 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9213491C3500453707 /* UIKit.framework */; }; 01308D9513491C3500453707 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9413491C3500453707 /* Foundation.framework */; }; 01308D9713491C3500453707 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9613491C3500453707 /* CoreGraphics.framework */; }; 01308DC013491F7200453707 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308DBF13491F7200453707 /* QuartzCore.framework */; }; 013F5C60168A59F500355CAD /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 013F5C5F168A59F500355CAD /* Default-568h@2x.png */; }; 0148358813A36C2000E687AC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358313A36C2000E687AC /* main.m */; }; 0148359313A36C3700E687AC /* iCarouselExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */; }; 0148359413A36C3700E687AC /* iCarouselExampleAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */; }; 0148359513A36C3700E687AC /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0148358F13A36C3700E687AC /* MainWindow.xib */; }; 0148359613A36C3700E687AC /* iCarouselExampleViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */; }; B2E5E6C1146145C900EADB7A /* iCarousel.m in Sources */ = {isa = PBXBuildFile; fileRef = B2E5E6C0146145C900EADB7A /* iCarousel.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 01308D9213491C3500453707 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 01308D9413491C3500453707 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 01308D9613491C3500453707 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 01308DBF13491F7200453707 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 013F5C5F168A59F500355CAD /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = SOURCE_ROOT; }; 0148358313A36C2000E687AC /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = SOURCE_ROOT; }; 0148358413A36C2000E687AC /* iCarouselExample-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "iCarouselExample-Info.plist"; sourceTree = SOURCE_ROOT; }; 0148358513A36C2000E687AC /* iCarouselExample-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "iCarouselExample-Prefix.pch"; sourceTree = SOURCE_ROOT; }; 0148358713A36C2000E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = SOURCE_ROOT; }; 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleViewController.m; sourceTree = SOURCE_ROOT; }; 0148358C13A36C3700E687AC /* iCarouselExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleViewController.h; sourceTree = SOURCE_ROOT; }; 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleAppDelegate.m; sourceTree = SOURCE_ROOT; }; 0148358E13A36C3700E687AC /* iCarouselExampleAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleAppDelegate.h; sourceTree = SOURCE_ROOT; }; 0148359013A36C3700E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainWindow.xib; sourceTree = SOURCE_ROOT; }; 0148359213A36C3700E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/iCarouselExampleViewController.xib; sourceTree = SOURCE_ROOT; }; 018BBCB413A375AF005CA505 /* iCarouselExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iCarouselExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; B2E5E6BF146145C900EADB7A /* iCarousel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarousel.h; sourceTree = ""; }; B2E5E6C0146145C900EADB7A /* iCarousel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarousel.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 01308D8B13491C3500453707 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 01308DC013491F7200453707 /* QuartzCore.framework in Frameworks */, 01308D9313491C3500453707 /* UIKit.framework in Frameworks */, 01308D9513491C3500453707 /* Foundation.framework in Frameworks */, 01308D9713491C3500453707 /* CoreGraphics.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 01308D8313491C3500453707 = { isa = PBXGroup; children = ( B2E5E6BE146145C900EADB7A /* iCarousel */, 01308D9813491C3500453707 /* iCarouselExample */, 01308D9113491C3500453707 /* Frameworks */, 01308D8F13491C3500453707 /* Products */, ); sourceTree = ""; }; 01308D8F13491C3500453707 /* Products */ = { isa = PBXGroup; children = ( 018BBCB413A375AF005CA505 /* iCarouselExample.app */, ); name = Products; sourceTree = ""; }; 01308D9113491C3500453707 /* Frameworks */ = { isa = PBXGroup; children = ( 01308DBF13491F7200453707 /* QuartzCore.framework */, 01308D9213491C3500453707 /* UIKit.framework */, 01308D9413491C3500453707 /* Foundation.framework */, 01308D9613491C3500453707 /* CoreGraphics.framework */, ); name = Frameworks; sourceTree = ""; }; 01308D9813491C3500453707 /* iCarouselExample */ = { isa = PBXGroup; children = ( 0148358E13A36C3700E687AC /* iCarouselExampleAppDelegate.h */, 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */, 0148358F13A36C3700E687AC /* MainWindow.xib */, 0148358C13A36C3700E687AC /* iCarouselExampleViewController.h */, 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */, 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */, 01308D9913491C3500453707 /* Supporting Files */, ); path = iCarouselExample; sourceTree = ""; }; 01308D9913491C3500453707 /* Supporting Files */ = { isa = PBXGroup; children = ( 013F5C5F168A59F500355CAD /* Default-568h@2x.png */, 0148358313A36C2000E687AC /* main.m */, 0148358413A36C2000E687AC /* iCarouselExample-Info.plist */, 0148358513A36C2000E687AC /* iCarouselExample-Prefix.pch */, 0148358613A36C2000E687AC /* InfoPlist.strings */, ); name = "Supporting Files"; sourceTree = ""; }; B2E5E6BE146145C900EADB7A /* iCarousel */ = { isa = PBXGroup; children = ( B2E5E6BF146145C900EADB7A /* iCarousel.h */, B2E5E6C0146145C900EADB7A /* iCarousel.m */, ); name = iCarousel; path = ../../iCarousel; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 01308D8D13491C3500453707 /* iCarouselExample */ = { isa = PBXNativeTarget; buildConfigurationList = 01308DAF13491C3500453707 /* Build configuration list for PBXNativeTarget "iCarouselExample" */; buildPhases = ( 01308D8A13491C3500453707 /* Sources */, 01308D8B13491C3500453707 /* Frameworks */, 01308D8C13491C3500453707 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = iCarouselExample; productName = iCarouselExample; productReference = 018BBCB413A375AF005CA505 /* iCarouselExample.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 01308D8513491C3500453707 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0800; }; buildConfigurationList = 01308D8813491C3500453707 /* Build configuration list for PBXProject "iCarouselExample" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); mainGroup = 01308D8313491C3500453707; productRefGroup = 01308D8F13491C3500453707 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 01308D8D13491C3500453707 /* iCarouselExample */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 01308D8C13491C3500453707 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 0148359513A36C3700E687AC /* MainWindow.xib in Resources */, 0148359613A36C3700E687AC /* iCarouselExampleViewController.xib in Resources */, 013F5C60168A59F500355CAD /* Default-568h@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 01308D8A13491C3500453707 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 0148358813A36C2000E687AC /* main.m in Sources */, 0148359313A36C3700E687AC /* iCarouselExampleViewController.m in Sources */, 0148359413A36C3700E687AC /* iCarouselExampleAppDelegate.m in Sources */, B2E5E6C1146145C900EADB7A /* iCarousel.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 0148358613A36C2000E687AC /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( 0148358713A36C2000E687AC /* en */, ); name = InfoPlist.strings; sourceTree = ""; }; 0148358F13A36C3700E687AC /* MainWindow.xib */ = { isa = PBXVariantGroup; children = ( 0148359013A36C3700E687AC /* en */, ); name = MainWindow.xib; sourceTree = ""; }; 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */ = { isa = PBXVariantGroup; children = ( 0148359213A36C3700E687AC /* en */, ); name = iCarouselExampleViewController.xib; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 01308DAD13491C3500453707 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = DEBUG; GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_TREAT_WARNINGS_AS_ERRORS = YES; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; ONLY_ACTIVE_ARCH = YES; RUN_CLANG_STATIC_ANALYZER = YES; SDKROOT = iphoneos; }; name = Debug; }; 01308DAE13491C3500453707 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_TREAT_WARNINGS_AS_ERRORS = YES; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; RUN_CLANG_STATIC_ANALYZER = YES; SDKROOT = iphoneos; }; name = Release; }; 01308DB013491C3500453707 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselExample-Prefix.pch"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = ""; INFOPLIST_FILE = "iCarouselExample-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = iCarouselExample; TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = app; }; name = Debug; }; 01308DB113491C3500453707 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselExample-Prefix.pch"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = ""; INFOPLIST_FILE = "iCarouselExample-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = iCarouselExample; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; WRAPPER_EXTENSION = app; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 01308D8813491C3500453707 /* Build configuration list for PBXProject "iCarouselExample" */ = { isa = XCConfigurationList; buildConfigurations = ( 01308DAD13491C3500453707 /* Debug */, 01308DAE13491C3500453707 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 01308DAF13491C3500453707 /* Build configuration list for PBXNativeTarget "iCarouselExample" */ = { isa = XCConfigurationList; buildConfigurations = ( 01308DB013491C3500453707 /* Debug */, 01308DB113491C3500453707 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 01308D8513491C3500453707 /* Project object */; } ================================================ FILE: Examples/Paging Example/iCarouselExampleAppDelegate.h ================================================ // // iCarouselExampleAppDelegate.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import @class iCarouselExampleViewController; @interface iCarouselExampleAppDelegate : NSObject @property (nonatomic, strong) IBOutlet UIWindow *window; @property (nonatomic, strong) IBOutlet iCarouselExampleViewController *viewController; @end ================================================ FILE: Examples/Paging Example/iCarouselExampleAppDelegate.m ================================================ // // iCarouselExampleAppDelegate.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleAppDelegate.h" #import "iCarouselExampleViewController.h" @implementation iCarouselExampleAppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { _window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; _window.rootViewController = _viewController; [_window makeKeyAndVisible]; return YES; } @end ================================================ FILE: Examples/Paging Example/iCarouselExampleViewController.h ================================================ // // iCarouselExampleViewController.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import #import "iCarousel.h" @interface iCarouselExampleViewController : UIViewController @property (nonatomic, strong) IBOutlet iCarousel *carousel; @end ================================================ FILE: Examples/Paging Example/iCarouselExampleViewController.m ================================================ // // iCarouselExampleViewController.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleViewController.h" @interface iCarouselExampleViewController () @property (nonatomic, strong) NSMutableArray *items; @end @implementation iCarouselExampleViewController - (void)awakeFromNib { [super awakeFromNib]; //set up data //your carousel should always be driven by an array of //data of some kind - don't store data in your item views //or the recycling mechanism will destroy your data once //your item views move off-screen self.items = [NSMutableArray array]; for (int i = 0; i < 100; i++) { [_items addObject:@(i)]; } } - (void)dealloc { //it's a good idea to set these to nil here to avoid //sending messages to a deallocated viewcontroller //this is true even if your project is using ARC, unless //you are targeting iOS 5 as a minimum deployment target _carousel.delegate = nil; _carousel.dataSource = nil; } #pragma mark - #pragma mark View lifecycle - (void)viewDidLoad { [super viewDidLoad]; //configure carousel _carousel.type = iCarouselTypeLinear; _carousel.pagingEnabled = YES; } - (void)viewDidUnload { [super viewDidUnload]; //free up memory by releasing subviews self.carousel = nil; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } #pragma mark - #pragma mark iCarousel methods - (NSInteger)numberOfItemsInCarousel:(iCarousel *)carousel { //return the total number of items in the carousel return [_items count]; } - (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view { UILabel *label = nil; //create new view if no view is available for recycling if (view == nil) { //don't do anything specific to the index within //this `if (view == nil) {...}` statement because the view will be //recycled and used with other index values later view = [[UIView alloc] initWithFrame:self.carousel.bounds]; label = [[UILabel alloc] initWithFrame:view.bounds]; label.backgroundColor = [UIColor clearColor]; label.textAlignment = NSTextAlignmentCenter; label.font = [label.font fontWithSize:50]; label.tag = 1; [view addSubview:label]; } else { //get a reference to the label in the recycled view label = (UILabel *)[view viewWithTag:1]; } //set background color CGFloat red = arc4random() / (CGFloat)INT_MAX; CGFloat green = arc4random() / (CGFloat)INT_MAX; CGFloat blue = arc4random() / (CGFloat)INT_MAX; view.backgroundColor = [UIColor colorWithRed:red green:green blue:blue alpha:1.0]; //set item label //remember to always set any properties of your carousel item //views outside of the `if (view == nil) {...}` check otherwise //you'll get weird issues with carousel item content appearing //in the wrong place in the carousel label.text = [_items[index] stringValue]; return view; } @end ================================================ FILE: Examples/Paging Example/main.m ================================================ // // main.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import int main(int argc, char *argv[]) { @autoreleasepool { int retVal = UIApplicationMain(argc, argv, nil, nil); return retVal; } } ================================================ FILE: Examples/Storyboard Demo/StoryboardExample/AppDelegate.h ================================================ // // AppDelegate.h // StoryboardExample // // Created by Nick Lockwood on 08/06/2012. // Copyright (c) 2012 __MyCompanyName__. All rights reserved. // #import @interface AppDelegate : UIResponder @property (strong, nonatomic) UIWindow *window; @end ================================================ FILE: Examples/Storyboard Demo/StoryboardExample/AppDelegate.m ================================================ // // AppDelegate.m // StoryboardExample // // Created by Nick Lockwood on 08/06/2012. // Copyright (c) 2012 __MyCompanyName__. All rights reserved. // #import "AppDelegate.h" @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. return YES; } @end ================================================ FILE: Examples/Storyboard Demo/StoryboardExample/StoryboardExample-Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleDisplayName ${PRODUCT_NAME} CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1.0 LSRequiresIPhoneOS UIMainStoryboardFile MainStoryboard UIRequiredDeviceCapabilities armv7 UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight ================================================ FILE: Examples/Storyboard Demo/StoryboardExample/StoryboardExample-Prefix.pch ================================================ // // Prefix header for all source files of the 'StoryboardExample' target in the 'StoryboardExample' project // #import #ifndef __IPHONE_5_0 #warning "This project uses features only available in iOS SDK 5.0 and later." #endif #ifdef __OBJC__ #import #import #endif ================================================ FILE: Examples/Storyboard Demo/StoryboardExample/ViewController.h ================================================ // // ViewController.h // StoryboardExample // // Created by Nick Lockwood on 08/06/2012. // Copyright (c) 2012 __MyCompanyName__. All rights reserved. // #import #import "iCarousel.h" @interface ViewController : UIViewController @property (nonatomic, strong) IBOutlet iCarousel *carousel; @end ================================================ FILE: Examples/Storyboard Demo/StoryboardExample/ViewController.m ================================================ // // ViewController.m // StoryboardExample // // Created by Nick Lockwood on 08/06/2012. // Copyright (c) 2012 __MyCompanyName__. All rights reserved. // #import "ViewController.h" @interface ViewController () @property (nonatomic, strong) NSMutableArray *items; @end @implementation ViewController @synthesize carousel; @synthesize items; - (void)awakeFromNib { [super awakeFromNib]; //set up data //your carousel should always be driven by an array of //data of some kind - don't store data in your item views //or the recycling mechanism will destroy your data once //your item views move off-screen self.items = [NSMutableArray array]; for (int i = 0; i < 1000; i++) { [items addObject:@(i)]; } } - (void)dealloc { //it's a good idea to set these to nil here to avoid //sending messages to a deallocated viewcontroller carousel.delegate = nil; carousel.dataSource = nil; } #pragma mark - #pragma mark View lifecycle - (void)viewDidLoad { [super viewDidLoad]; //configure carousel carousel.type = iCarouselTypeCoverFlow2; } - (void)viewDidUnload { [super viewDidUnload]; //free up memory by releasing subviews self.carousel = nil; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } #pragma mark - #pragma mark iCarousel methods - (NSInteger)numberOfItemsInCarousel:(iCarousel *)carousel { //return the total number of items in the carousel return [items count]; } - (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view { UILabel *label = nil; //create new view if no view is available for recycling if (view == nil) { view = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 200.0f, 200.0f)]; ((UIImageView *)view).image = [UIImage imageNamed:@"page.png"]; view.contentMode = UIViewContentModeCenter; label = [[UILabel alloc] initWithFrame:view.bounds]; label.backgroundColor = [UIColor clearColor]; label.textAlignment = NSTextAlignmentCenter; label.font = [label.font fontWithSize:50]; label.tag = 1; [view addSubview:label]; } else { //get a reference to the label in the recycled view label = (UILabel *)[view viewWithTag:1]; } //set item label //remember to always set any properties of your carousel item //views outside of the `if (view == nil) {...}` check otherwise //you'll get weird issues with carousel item content appearing //in the wrong place in the carousel label.text = [items[index] stringValue]; return view; } @end ================================================ FILE: Examples/Storyboard Demo/StoryboardExample/en.lproj/InfoPlist.strings ================================================ /* Localized versions of Info.plist keys */ ================================================ FILE: Examples/Storyboard Demo/StoryboardExample/en.lproj/MainStoryboard.storyboard ================================================ ================================================ FILE: Examples/Storyboard Demo/StoryboardExample/main.m ================================================ // // main.m // StoryboardExample // // Created by Nick Lockwood on 08/06/2012. // Copyright (c) 2012 __MyCompanyName__. All rights reserved. // #import #import "AppDelegate.h" int main(int argc, char *argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } } ================================================ FILE: Examples/Storyboard Demo/StoryboardExample.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 0134E14C177C85B10007BF1A /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 0134E14B177C85B10007BF1A /* Default-568h@2x.png */; }; B2E56E5C158250730090ECAC /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2E56E5B158250730090ECAC /* UIKit.framework */; }; B2E56E5E158250730090ECAC /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2E56E5D158250730090ECAC /* Foundation.framework */; }; B2E56E60158250730090ECAC /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2E56E5F158250730090ECAC /* CoreGraphics.framework */; }; B2E56E66158250730090ECAC /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = B2E56E64158250730090ECAC /* InfoPlist.strings */; }; B2E56E68158250730090ECAC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = B2E56E67158250730090ECAC /* main.m */; }; B2E56E6C158250730090ECAC /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B2E56E6B158250730090ECAC /* AppDelegate.m */; }; B2E56E6F158250740090ECAC /* MainStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B2E56E6D158250740090ECAC /* MainStoryboard.storyboard */; }; B2E56E72158250740090ECAC /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B2E56E71158250740090ECAC /* ViewController.m */; }; B2E56E83158250C20090ECAC /* iCarousel.m in Sources */ = {isa = PBXBuildFile; fileRef = B2E56E82158250C20090ECAC /* iCarousel.m */; }; B2E56E88158250D30090ECAC /* background.png in Resources */ = {isa = PBXBuildFile; fileRef = B2E56E86158250D30090ECAC /* background.png */; }; B2E56E89158250D30090ECAC /* page.png in Resources */ = {isa = PBXBuildFile; fileRef = B2E56E87158250D30090ECAC /* page.png */; }; B2E56E8B158251A90090ECAC /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2E56E8A158251A90090ECAC /* QuartzCore.framework */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 0134E14B177C85B10007BF1A /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; B2E56E57158250730090ECAC /* StoryboardExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = StoryboardExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; B2E56E5B158250730090ECAC /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; B2E56E5D158250730090ECAC /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; B2E56E5F158250730090ECAC /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; B2E56E63158250730090ECAC /* StoryboardExample-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "StoryboardExample-Info.plist"; sourceTree = ""; }; B2E56E65158250730090ECAC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; B2E56E67158250730090ECAC /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; B2E56E69158250730090ECAC /* StoryboardExample-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "StoryboardExample-Prefix.pch"; sourceTree = ""; }; B2E56E6A158250730090ECAC /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; B2E56E6B158250730090ECAC /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; B2E56E6E158250740090ECAC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = en.lproj/MainStoryboard.storyboard; sourceTree = ""; }; B2E56E70158250740090ECAC /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; B2E56E71158250740090ECAC /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; B2E56E81158250C20090ECAC /* iCarousel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarousel.h; sourceTree = ""; }; B2E56E82158250C20090ECAC /* iCarousel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarousel.m; sourceTree = ""; }; B2E56E86158250D30090ECAC /* background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = background.png; sourceTree = ""; }; B2E56E87158250D30090ECAC /* page.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = page.png; sourceTree = ""; }; B2E56E8A158251A90090ECAC /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ B2E56E54158250730090ECAC /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( B2E56E8B158251A90090ECAC /* QuartzCore.framework in Frameworks */, B2E56E5C158250730090ECAC /* UIKit.framework in Frameworks */, B2E56E5E158250730090ECAC /* Foundation.framework in Frameworks */, B2E56E60158250730090ECAC /* CoreGraphics.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ B2E56E4C158250730090ECAC = { isa = PBXGroup; children = ( B2E56E80158250C20090ECAC /* iCarousel */, B2E56E85158250D30090ECAC /* Resources */, B2E56E61158250730090ECAC /* StoryboardExample */, B2E56E5A158250730090ECAC /* Frameworks */, B2E56E58158250730090ECAC /* Products */, ); sourceTree = ""; }; B2E56E58158250730090ECAC /* Products */ = { isa = PBXGroup; children = ( B2E56E57158250730090ECAC /* StoryboardExample.app */, ); name = Products; sourceTree = ""; }; B2E56E5A158250730090ECAC /* Frameworks */ = { isa = PBXGroup; children = ( B2E56E8A158251A90090ECAC /* QuartzCore.framework */, B2E56E5B158250730090ECAC /* UIKit.framework */, B2E56E5D158250730090ECAC /* Foundation.framework */, B2E56E5F158250730090ECAC /* CoreGraphics.framework */, ); name = Frameworks; sourceTree = ""; }; B2E56E61158250730090ECAC /* StoryboardExample */ = { isa = PBXGroup; children = ( B2E56E6A158250730090ECAC /* AppDelegate.h */, B2E56E6B158250730090ECAC /* AppDelegate.m */, B2E56E6D158250740090ECAC /* MainStoryboard.storyboard */, B2E56E70158250740090ECAC /* ViewController.h */, B2E56E71158250740090ECAC /* ViewController.m */, B2E56E62158250730090ECAC /* Supporting Files */, ); path = StoryboardExample; sourceTree = ""; }; B2E56E62158250730090ECAC /* Supporting Files */ = { isa = PBXGroup; children = ( 0134E14B177C85B10007BF1A /* Default-568h@2x.png */, B2E56E63158250730090ECAC /* StoryboardExample-Info.plist */, B2E56E64158250730090ECAC /* InfoPlist.strings */, B2E56E67158250730090ECAC /* main.m */, B2E56E69158250730090ECAC /* StoryboardExample-Prefix.pch */, ); name = "Supporting Files"; sourceTree = ""; }; B2E56E80158250C20090ECAC /* iCarousel */ = { isa = PBXGroup; children = ( B2E56E81158250C20090ECAC /* iCarousel.h */, B2E56E82158250C20090ECAC /* iCarousel.m */, ); name = iCarousel; path = ../../iCarousel; sourceTree = ""; }; B2E56E85158250D30090ECAC /* Resources */ = { isa = PBXGroup; children = ( B2E56E86158250D30090ECAC /* background.png */, B2E56E87158250D30090ECAC /* page.png */, ); name = Resources; path = ../Resources; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ B2E56E56158250730090ECAC /* StoryboardExample */ = { isa = PBXNativeTarget; buildConfigurationList = B2E56E75158250740090ECAC /* Build configuration list for PBXNativeTarget "StoryboardExample" */; buildPhases = ( B2E56E53158250730090ECAC /* Sources */, B2E56E54158250730090ECAC /* Frameworks */, B2E56E55158250730090ECAC /* Resources */, ); buildRules = ( ); dependencies = ( ); name = StoryboardExample; productName = StoryboardExample; productReference = B2E56E57158250730090ECAC /* StoryboardExample.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ B2E56E4E158250730090ECAC /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0800; }; buildConfigurationList = B2E56E51158250730090ECAC /* Build configuration list for PBXProject "StoryboardExample" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); mainGroup = B2E56E4C158250730090ECAC; productRefGroup = B2E56E58158250730090ECAC /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( B2E56E56158250730090ECAC /* StoryboardExample */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ B2E56E55158250730090ECAC /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( B2E56E66158250730090ECAC /* InfoPlist.strings in Resources */, B2E56E6F158250740090ECAC /* MainStoryboard.storyboard in Resources */, B2E56E88158250D30090ECAC /* background.png in Resources */, B2E56E89158250D30090ECAC /* page.png in Resources */, 0134E14C177C85B10007BF1A /* Default-568h@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ B2E56E53158250730090ECAC /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( B2E56E68158250730090ECAC /* main.m in Sources */, B2E56E6C158250730090ECAC /* AppDelegate.m in Sources */, B2E56E72158250740090ECAC /* ViewController.m in Sources */, B2E56E83158250C20090ECAC /* iCarousel.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ B2E56E64158250730090ECAC /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( B2E56E65158250730090ECAC /* en */, ); name = InfoPlist.strings; sourceTree = ""; }; B2E56E6D158250740090ECAC /* MainStoryboard.storyboard */ = { isa = PBXVariantGroup; children = ( B2E56E6E158250740090ECAC /* en */, ); name = MainStoryboard.storyboard; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ B2E56E73158250740090ECAC /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; }; name = Debug; }; B2E56E74158250740090ECAC /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = YES; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; }; name = Release; }; B2E56E76158250740090ECAC /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_OBJC_ARC = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "StoryboardExample/StoryboardExample-Prefix.pch"; INFOPLIST_FILE = "StoryboardExample/StoryboardExample-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoalDesign.StoryboardExample.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = app; }; name = Debug; }; B2E56E77158250740090ECAC /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_OBJC_ARC = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "StoryboardExample/StoryboardExample-Prefix.pch"; INFOPLIST_FILE = "StoryboardExample/StoryboardExample-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoalDesign.StoryboardExample.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = app; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ B2E56E51158250730090ECAC /* Build configuration list for PBXProject "StoryboardExample" */ = { isa = XCConfigurationList; buildConfigurations = ( B2E56E73158250740090ECAC /* Debug */, B2E56E74158250740090ECAC /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; B2E56E75158250740090ECAC /* Build configuration list for PBXNativeTarget "StoryboardExample" */ = { isa = XCConfigurationList; buildConfigurations = ( B2E56E76158250740090ECAC /* Debug */, B2E56E77158250740090ECAC /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = B2E56E4E158250730090ECAC /* Project object */; } ================================================ FILE: Examples/Swift Example/SwiftExample/AppDelegate.swift ================================================ // // AppDelegate.swift // SwiftExample // // Created by Nick Lockwood on 30/07/2014. // Copyright (c) 2014 Charcoal Design. All rights reserved. // import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? } ================================================ FILE: Examples/Swift Example/SwiftExample/Base.lproj/Main.storyboard ================================================ ================================================ FILE: Examples/Swift Example/SwiftExample/Images.xcassets/AppIcon.appiconset/Contents.json ================================================ { "images" : [ { "idiom" : "iphone", "size" : "29x29", "scale" : "2x" }, { "idiom" : "iphone", "size" : "40x40", "scale" : "2x" }, { "idiom" : "iphone", "size" : "60x60", "scale" : "2x" } ], "info" : { "version" : 1, "author" : "xcode" } } ================================================ FILE: Examples/Swift Example/SwiftExample/Images.xcassets/LaunchImage.launchimage/Contents.json ================================================ { "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" } } ================================================ FILE: Examples/Swift Example/SwiftExample/Images.xcassets/background.imageset/Contents.json ================================================ { "images" : [ { "idiom" : "universal" }, { "idiom" : "universal", "scale" : "1x", "filename" : "background.png" }, { "idiom" : "universal", "scale" : "2x" } ], "info" : { "version" : 1, "author" : "xcode" } } ================================================ FILE: Examples/Swift Example/SwiftExample/Images.xcassets/page.imageset/Contents.json ================================================ { "images" : [ { "idiom" : "universal" }, { "idiom" : "universal", "scale" : "1x", "filename" : "page.png" }, { "idiom" : "universal", "scale" : "2x" } ], "info" : { "version" : 1, "author" : "xcode" } } ================================================ FILE: Examples/Swift Example/SwiftExample/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1 LSRequiresIPhoneOS UIMainStoryboardFile Main UIRequiredDeviceCapabilities armv7 ================================================ FILE: Examples/Swift Example/SwiftExample/SwiftExample-Bridging-Header.h ================================================ // // SwiftExample-Bridging-Header.h // SwiftExample // // Created by Nick Lockwood on 30/07/2014. // Copyright (c) 2014 Charcoal Design. All rights reserved. // #import "iCarousel.h" ================================================ FILE: Examples/Swift Example/SwiftExample/ViewController.swift ================================================ // // ViewController.swift // SwiftExample // // Created by Nick Lockwood on 30/07/2014. // Copyright (c) 2014 Charcoal Design. All rights reserved. // import UIKit class ViewController: UIViewController, iCarouselDataSource, iCarouselDelegate { var items: [Int] = [] @IBOutlet var carousel: iCarousel! override func awakeFromNib() { super.awakeFromNib() for i in 0 ... 99 { items.append(i) } } override func viewDidLoad() { super.viewDidLoad() carousel.type = .CoverFlow2 } func numberOfItemsInCarousel(carousel: iCarousel) -> Int { return items.count } func carousel(carousel: iCarousel, viewForItemAtIndex index: Int, reusingView view: UIView?) -> UIView { var label: UILabel var itemView: UIImageView //reuse view if available, otherwise create a new view if let view = view as? UIImageView { itemView = view //get a reference to the label in the recycled view label = itemView.viewWithTag(1) as! UILabel } else { //don't do anything specific to the index within //this `if ... else` statement because the view will be //recycled and used with other index values later itemView = UIImageView(frame: CGRect(x: 0, y: 0, width: 200, height: 200)) itemView.image = UIImage(named: "page.png") itemView.contentMode = .Center label = UILabel(frame: itemView.bounds) label.backgroundColor = UIColor.clearColor() label.textAlignment = .Center label.font = label.font.fontWithSize(50) label.tag = 1 itemView.addSubview(label) } //set item label //remember to always set any properties of your carousel item //views outside of the `if (view == nil) {...}` check otherwise //you'll get weird issues with carousel item content appearing //in the wrong place in the carousel label.text = "\(items[index])" return itemView } func carousel(carousel: iCarousel, valueForOption option: iCarouselOption, withDefault value: CGFloat) -> CGFloat { if (option == .Spacing) { return value * 1.1 } return value } } ================================================ FILE: Examples/Swift Example/SwiftExample.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 018F22011DBCCDBF00BDBD68 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 018F22001DBCCDBF00BDBD68 /* Default-568h@2x.png */; }; 138BCA6B1989946E0009467C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 138BCA6A1989946E0009467C /* AppDelegate.swift */; }; 138BCA6D1989946E0009467C /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 138BCA6C1989946E0009467C /* ViewController.swift */; }; 138BCA701989946E0009467C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 138BCA6E1989946E0009467C /* Main.storyboard */; }; 138BCA721989946E0009467C /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 138BCA711989946E0009467C /* Images.xcassets */; }; 13F10FEB198997000066DA2E /* iCarousel.m in Sources */ = {isa = PBXBuildFile; fileRef = 13F10FEA198997000066DA2E /* iCarousel.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 018F22001DBCCDBF00BDBD68 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; 138BCA651989946E0009467C /* SwiftExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 138BCA691989946E0009467C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 138BCA6A1989946E0009467C /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 138BCA6C1989946E0009467C /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 138BCA6F1989946E0009467C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 138BCA711989946E0009467C /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 13F10FE9198997000066DA2E /* iCarousel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarousel.h; sourceTree = ""; }; 13F10FEA198997000066DA2E /* iCarousel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarousel.m; sourceTree = ""; }; 13F10FEC198997560066DA2E /* SwiftExample-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SwiftExample-Bridging-Header.h"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 138BCA621989946E0009467C /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 138BCA5C1989946E0009467C = { isa = PBXGroup; children = ( 13F10FE8198997000066DA2E /* iCarousel */, 138BCA671989946E0009467C /* SwiftExample */, 138BCA661989946E0009467C /* Products */, ); indentWidth = 4; sourceTree = ""; tabWidth = 4; }; 138BCA661989946E0009467C /* Products */ = { isa = PBXGroup; children = ( 138BCA651989946E0009467C /* SwiftExample.app */, ); name = Products; sourceTree = ""; }; 138BCA671989946E0009467C /* SwiftExample */ = { isa = PBXGroup; children = ( 13F10FEC198997560066DA2E /* SwiftExample-Bridging-Header.h */, 138BCA6A1989946E0009467C /* AppDelegate.swift */, 138BCA6C1989946E0009467C /* ViewController.swift */, 138BCA6E1989946E0009467C /* Main.storyboard */, 138BCA711989946E0009467C /* Images.xcassets */, 138BCA681989946E0009467C /* Supporting Files */, ); path = SwiftExample; sourceTree = ""; }; 138BCA681989946E0009467C /* Supporting Files */ = { isa = PBXGroup; children = ( 018F22001DBCCDBF00BDBD68 /* Default-568h@2x.png */, 138BCA691989946E0009467C /* Info.plist */, ); name = "Supporting Files"; sourceTree = ""; }; 13F10FE8198997000066DA2E /* iCarousel */ = { isa = PBXGroup; children = ( 13F10FE9198997000066DA2E /* iCarousel.h */, 13F10FEA198997000066DA2E /* iCarousel.m */, ); name = iCarousel; path = ../../iCarousel; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 138BCA641989946E0009467C /* SwiftExample */ = { isa = PBXNativeTarget; buildConfigurationList = 138BCA811989946E0009467C /* Build configuration list for PBXNativeTarget "SwiftExample" */; buildPhases = ( 138BCA611989946E0009467C /* Sources */, 138BCA621989946E0009467C /* Frameworks */, 138BCA631989946E0009467C /* Resources */, ); buildRules = ( ); dependencies = ( ); name = SwiftExample; productName = SwiftExample; productReference = 138BCA651989946E0009467C /* SwiftExample.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 138BCA5D1989946E0009467C /* Project object */ = { isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0700; LastUpgradeCheck = 0800; ORGANIZATIONNAME = "Charcoal Design"; TargetAttributes = { 138BCA641989946E0009467C = { CreatedOnToolsVersion = 6.0; LastSwiftMigration = 0800; }; }; }; buildConfigurationList = 138BCA601989946E0009467C /* Build configuration list for PBXProject "SwiftExample" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, Base, ); mainGroup = 138BCA5C1989946E0009467C; productRefGroup = 138BCA661989946E0009467C /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 138BCA641989946E0009467C /* SwiftExample */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 138BCA631989946E0009467C /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 138BCA701989946E0009467C /* Main.storyboard in Resources */, 138BCA721989946E0009467C /* Images.xcassets in Resources */, 018F22011DBCCDBF00BDBD68 /* Default-568h@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 138BCA611989946E0009467C /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 13F10FEB198997000066DA2E /* iCarousel.m in Sources */, 138BCA6D1989946E0009467C /* ViewController.swift in Sources */, 138BCA6B1989946E0009467C /* AppDelegate.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 138BCA6E1989946E0009467C /* Main.storyboard */ = { isa = PBXVariantGroup; children = ( 138BCA6F1989946E0009467C /* Base */, ); name = Main.storyboard; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 138BCA7F1989946E0009467C /* 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_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; }; 138BCA801989946E0009467C /* 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_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = YES; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; VALIDATE_PRODUCT = YES; }; name = Release; }; 138BCA821989946E0009467C /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; DEFINES_MODULE = YES; INFOPLIST_FILE = SwiftExample/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MODULE_NAME = ""; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_MODULE_NAME = SwiftExample; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "SwiftExample/SwiftExample-Bridging-Header.h"; SWIFT_VERSION = 2.3; }; name = Debug; }; 138BCA831989946E0009467C /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; DEFINES_MODULE = YES; INFOPLIST_FILE = SwiftExample/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MODULE_NAME = ""; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_MODULE_NAME = SwiftExample; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "SwiftExample/SwiftExample-Bridging-Header.h"; SWIFT_VERSION = 2.3; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 138BCA601989946E0009467C /* Build configuration list for PBXProject "SwiftExample" */ = { isa = XCConfigurationList; buildConfigurations = ( 138BCA7F1989946E0009467C /* Debug */, 138BCA801989946E0009467C /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 138BCA811989946E0009467C /* Build configuration list for PBXNativeTarget "SwiftExample" */ = { isa = XCConfigurationList; buildConfigurations = ( 138BCA821989946E0009467C /* Debug */, 138BCA831989946E0009467C /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 138BCA5D1989946E0009467C /* Project object */; } ================================================ FILE: Examples/Swift3 Example/SwiftExample/AppDelegate.swift ================================================ // // AppDelegate.swift // SwiftExample // // Created by Nick Lockwood on 30/07/2014. // Copyright (c) 2014 Charcoal Design. All rights reserved. // import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? } ================================================ FILE: Examples/Swift3 Example/SwiftExample/Base.lproj/Main.storyboard ================================================ ================================================ FILE: Examples/Swift3 Example/SwiftExample/Images.xcassets/AppIcon.appiconset/Contents.json ================================================ { "images" : [ { "idiom" : "iphone", "size" : "20x20", "scale" : "2x" }, { "idiom" : "iphone", "size" : "20x20", "scale" : "3x" }, { "idiom" : "iphone", "size" : "29x29", "scale" : "2x" }, { "idiom" : "iphone", "size" : "29x29", "scale" : "3x" }, { "idiom" : "iphone", "size" : "40x40", "scale" : "2x" }, { "idiom" : "iphone", "size" : "40x40", "scale" : "3x" }, { "idiom" : "iphone", "size" : "60x60", "scale" : "2x" }, { "idiom" : "iphone", "size" : "60x60", "scale" : "3x" } ], "info" : { "version" : 1, "author" : "xcode" } } ================================================ FILE: Examples/Swift3 Example/SwiftExample/Images.xcassets/LaunchImage.launchimage/Contents.json ================================================ { "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" } } ================================================ FILE: Examples/Swift3 Example/SwiftExample/Images.xcassets/background.imageset/Contents.json ================================================ { "images" : [ { "idiom" : "universal" }, { "idiom" : "universal", "filename" : "background.png", "scale" : "1x" }, { "idiom" : "universal", "scale" : "2x" }, { "idiom" : "universal", "scale" : "3x" } ], "info" : { "version" : 1, "author" : "xcode" } } ================================================ FILE: Examples/Swift3 Example/SwiftExample/Images.xcassets/page.imageset/Contents.json ================================================ { "images" : [ { "idiom" : "universal" }, { "idiom" : "universal", "filename" : "page.png", "scale" : "1x" }, { "idiom" : "universal", "scale" : "2x" }, { "idiom" : "universal", "scale" : "3x" } ], "info" : { "version" : 1, "author" : "xcode" } } ================================================ FILE: Examples/Swift3 Example/SwiftExample/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1 LSRequiresIPhoneOS UIMainStoryboardFile Main UIRequiredDeviceCapabilities armv7 ================================================ FILE: Examples/Swift3 Example/SwiftExample/SwiftExample-Bridging-Header.h ================================================ // // SwiftExample-Bridging-Header.h // SwiftExample // // Created by Nick Lockwood on 30/07/2014. // Copyright (c) 2014 Charcoal Design. All rights reserved. // #import "iCarousel.h" ================================================ FILE: Examples/Swift3 Example/SwiftExample/ViewController.swift ================================================ // // ViewController.swift // SwiftExample // // Created by Nick Lockwood on 30/07/2014. // Copyright (c) 2014 Charcoal Design. All rights reserved. // import UIKit class ViewController: UIViewController, iCarouselDataSource, iCarouselDelegate { var items: [Int] = [] @IBOutlet var carousel: iCarousel! override func awakeFromNib() { super.awakeFromNib() for i in 0 ... 99 { items.append(i) } } override func viewDidLoad() { super.viewDidLoad() carousel.type = .coverFlow2 } func numberOfItems(in carousel: iCarousel) -> Int { return items.count } func carousel(_ carousel: iCarousel, viewForItemAt index: Int, reusing view: UIView?) -> UIView { var label: UILabel var itemView: UIImageView //reuse view if available, otherwise create a new view if let view = view as? UIImageView { itemView = view //get a reference to the label in the recycled view label = itemView.viewWithTag(1) as! UILabel } else { //don't do anything specific to the index within //this `if ... else` statement because the view will be //recycled and used with other index values later itemView = UIImageView(frame: CGRect(x: 0, y: 0, width: 200, height: 200)) itemView.image = UIImage(named: "page.png") itemView.contentMode = .center label = UILabel(frame: itemView.bounds) label.backgroundColor = .clear label.textAlignment = .center label.font = label.font.withSize(50) label.tag = 1 itemView.addSubview(label) } //set item label //remember to always set any properties of your carousel item //views outside of the `if (view == nil) {...}` check otherwise //you'll get weird issues with carousel item content appearing //in the wrong place in the carousel label.text = "\(items[index])" return itemView } func carousel(_ carousel: iCarousel, valueFor option: iCarouselOption, withDefault value: CGFloat) -> CGFloat { if (option == .spacing) { return value * 1.1 } return value } } ================================================ FILE: Examples/Swift3 Example/SwiftExample.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 018F21FF1DBCCDA100BDBD68 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 018F21FE1DBCCDA100BDBD68 /* Default-568h@2x.png */; }; 138BCA6B1989946E0009467C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 138BCA6A1989946E0009467C /* AppDelegate.swift */; }; 138BCA6D1989946E0009467C /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 138BCA6C1989946E0009467C /* ViewController.swift */; }; 138BCA701989946E0009467C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 138BCA6E1989946E0009467C /* Main.storyboard */; }; 138BCA721989946E0009467C /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 138BCA711989946E0009467C /* Images.xcassets */; }; 13F10FEB198997000066DA2E /* iCarousel.m in Sources */ = {isa = PBXBuildFile; fileRef = 13F10FEA198997000066DA2E /* iCarousel.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 018F21FE1DBCCDA100BDBD68 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; 138BCA651989946E0009467C /* SwiftExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 138BCA691989946E0009467C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 138BCA6A1989946E0009467C /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 138BCA6C1989946E0009467C /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 138BCA6F1989946E0009467C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 138BCA711989946E0009467C /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 13F10FE9198997000066DA2E /* iCarousel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarousel.h; sourceTree = ""; }; 13F10FEA198997000066DA2E /* iCarousel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarousel.m; sourceTree = ""; }; 13F10FEC198997560066DA2E /* SwiftExample-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SwiftExample-Bridging-Header.h"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 138BCA621989946E0009467C /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 138BCA5C1989946E0009467C = { isa = PBXGroup; children = ( 13F10FE8198997000066DA2E /* iCarousel */, 138BCA671989946E0009467C /* SwiftExample */, 138BCA661989946E0009467C /* Products */, ); indentWidth = 4; sourceTree = ""; tabWidth = 4; }; 138BCA661989946E0009467C /* Products */ = { isa = PBXGroup; children = ( 138BCA651989946E0009467C /* SwiftExample.app */, ); name = Products; sourceTree = ""; }; 138BCA671989946E0009467C /* SwiftExample */ = { isa = PBXGroup; children = ( 13F10FEC198997560066DA2E /* SwiftExample-Bridging-Header.h */, 138BCA6A1989946E0009467C /* AppDelegate.swift */, 138BCA6C1989946E0009467C /* ViewController.swift */, 138BCA6E1989946E0009467C /* Main.storyboard */, 138BCA711989946E0009467C /* Images.xcassets */, 138BCA681989946E0009467C /* Supporting Files */, ); path = SwiftExample; sourceTree = ""; }; 138BCA681989946E0009467C /* Supporting Files */ = { isa = PBXGroup; children = ( 018F21FE1DBCCDA100BDBD68 /* Default-568h@2x.png */, 138BCA691989946E0009467C /* Info.plist */, ); name = "Supporting Files"; sourceTree = ""; }; 13F10FE8198997000066DA2E /* iCarousel */ = { isa = PBXGroup; children = ( 13F10FE9198997000066DA2E /* iCarousel.h */, 13F10FEA198997000066DA2E /* iCarousel.m */, ); name = iCarousel; path = ../../iCarousel; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 138BCA641989946E0009467C /* SwiftExample */ = { isa = PBXNativeTarget; buildConfigurationList = 138BCA811989946E0009467C /* Build configuration list for PBXNativeTarget "SwiftExample" */; buildPhases = ( 138BCA611989946E0009467C /* Sources */, 138BCA621989946E0009467C /* Frameworks */, 138BCA631989946E0009467C /* Resources */, ); buildRules = ( ); dependencies = ( ); name = SwiftExample; productName = SwiftExample; productReference = 138BCA651989946E0009467C /* SwiftExample.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 138BCA5D1989946E0009467C /* Project object */ = { isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0700; LastUpgradeCheck = 0800; ORGANIZATIONNAME = "Charcoal Design"; TargetAttributes = { 138BCA641989946E0009467C = { CreatedOnToolsVersion = 6.0; LastSwiftMigration = 0800; }; }; }; buildConfigurationList = 138BCA601989946E0009467C /* Build configuration list for PBXProject "SwiftExample" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, Base, ); mainGroup = 138BCA5C1989946E0009467C; productRefGroup = 138BCA661989946E0009467C /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 138BCA641989946E0009467C /* SwiftExample */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 138BCA631989946E0009467C /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 138BCA701989946E0009467C /* Main.storyboard in Resources */, 138BCA721989946E0009467C /* Images.xcassets in Resources */, 018F21FF1DBCCDA100BDBD68 /* Default-568h@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 138BCA611989946E0009467C /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 13F10FEB198997000066DA2E /* iCarousel.m in Sources */, 138BCA6D1989946E0009467C /* ViewController.swift in Sources */, 138BCA6B1989946E0009467C /* AppDelegate.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 138BCA6E1989946E0009467C /* Main.storyboard */ = { isa = PBXVariantGroup; children = ( 138BCA6F1989946E0009467C /* Base */, ); name = Main.storyboard; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 138BCA7F1989946E0009467C /* 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_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; }; 138BCA801989946E0009467C /* 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_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = YES; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; VALIDATE_PRODUCT = YES; }; name = Release; }; 138BCA821989946E0009467C /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; DEFINES_MODULE = YES; INFOPLIST_FILE = SwiftExample/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MODULE_NAME = ""; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_MODULE_NAME = SwiftExample; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "SwiftExample/SwiftExample-Bridging-Header.h"; SWIFT_VERSION = 3.0; }; name = Debug; }; 138BCA831989946E0009467C /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; DEFINES_MODULE = YES; INFOPLIST_FILE = SwiftExample/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MODULE_NAME = ""; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_MODULE_NAME = SwiftExample; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "SwiftExample/SwiftExample-Bridging-Header.h"; SWIFT_VERSION = 3.0; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 138BCA601989946E0009467C /* Build configuration list for PBXProject "SwiftExample" */ = { isa = XCConfigurationList; buildConfigurations = ( 138BCA7F1989946E0009467C /* Debug */, 138BCA801989946E0009467C /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 138BCA811989946E0009467C /* Build configuration list for PBXNativeTarget "SwiftExample" */ = { isa = XCConfigurationList; buildConfigurations = ( 138BCA821989946E0009467C /* Debug */, 138BCA831989946E0009467C /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 138BCA5D1989946E0009467C /* Project object */; } ================================================ FILE: Examples/Tables Demo/en.lproj/InfoPlist.strings ================================================ /* Localized versions of Info.plist keys */ ================================================ FILE: Examples/Tables Demo/en.lproj/MainWindow.xib ================================================ 1024 10D571 786 1038.29 460.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin 112 YES YES com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES YES YES IBFilesOwner IBCocoaTouchFramework IBFirstResponder IBCocoaTouchFramework IBCocoaTouchFramework iCarouselExampleViewController 1 IBCocoaTouchFramework NO 292 {320, 480} 1 MSAxIDEAA NO NO IBCocoaTouchFramework YES YES delegate 4 viewController 11 window 14 YES 0 -1 File's Owner 3 iCarouselExample App Delegate -2 10 12 YES YES -1.CustomClassName -2.CustomClassName 10.CustomClassName 10.IBEditorWindowLastContentRect 10.IBPluginDependency 12.IBEditorWindowLastContentRect 12.IBPluginDependency 3.CustomClassName 3.IBPluginDependency YES UIApplication UIResponder iCarouselExampleViewController {{234, 376}, {320, 480}} com.apple.InterfaceBuilder.IBCocoaTouchPlugin {{525, 346}, {320, 480}} com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarouselExampleAppDelegate com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES YES YES 15 YES UIWindow UIView IBUserSource iCarouselExampleAppDelegate NSObject YES YES viewController window YES iCarouselExampleViewController UIWindow YES YES viewController window YES viewController iCarouselExampleViewController window UIWindow IBProjectSource iCarouselExampleAppDelegate.h iCarouselExampleAppDelegate NSObject IBUserSource iCarouselExampleViewController UIViewController IBProjectSource iCarouselExampleViewController.h YES NSObject IBFrameworkSource Foundation.framework/Headers/NSError.h NSObject IBFrameworkSource Foundation.framework/Headers/NSFileManager.h NSObject IBFrameworkSource Foundation.framework/Headers/NSKeyValueCoding.h NSObject IBFrameworkSource Foundation.framework/Headers/NSKeyValueObserving.h NSObject IBFrameworkSource Foundation.framework/Headers/NSKeyedArchiver.h NSObject IBFrameworkSource Foundation.framework/Headers/NSObject.h NSObject IBFrameworkSource Foundation.framework/Headers/NSRunLoop.h NSObject IBFrameworkSource Foundation.framework/Headers/NSThread.h NSObject IBFrameworkSource Foundation.framework/Headers/NSURL.h NSObject IBFrameworkSource Foundation.framework/Headers/NSURLConnection.h NSObject IBFrameworkSource UIKit.framework/Headers/UIAccessibility.h NSObject IBFrameworkSource UIKit.framework/Headers/UINibLoading.h NSObject IBFrameworkSource UIKit.framework/Headers/UIResponder.h UIApplication UIResponder IBFrameworkSource UIKit.framework/Headers/UIApplication.h UIResponder NSObject UISearchBar UIView IBFrameworkSource UIKit.framework/Headers/UISearchBar.h UISearchDisplayController NSObject IBFrameworkSource UIKit.framework/Headers/UISearchDisplayController.h UIView IBFrameworkSource UIKit.framework/Headers/UITextField.h UIView UIResponder IBFrameworkSource UIKit.framework/Headers/UIView.h UIViewController IBFrameworkSource UIKit.framework/Headers/UINavigationController.h UIViewController IBFrameworkSource UIKit.framework/Headers/UIPopoverController.h UIViewController IBFrameworkSource UIKit.framework/Headers/UISplitViewController.h UIViewController IBFrameworkSource UIKit.framework/Headers/UITabBarController.h UIViewController UIResponder IBFrameworkSource UIKit.framework/Headers/UIViewController.h UIWindow UIView IBFrameworkSource UIKit.framework/Headers/UIWindow.h 0 IBCocoaTouchFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 YES iCarouselExample.xcodeproj 3 112 ================================================ FILE: Examples/Tables Demo/en.lproj/iCarouselExampleViewController.xib ================================================ 1280 11C74 1938 1138.23 567.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin 933 YES IBProxyObject IBUIView YES com.apple.InterfaceBuilder.IBCocoaTouchPlugin PluginDependencyRecalculationVersion YES IBFilesOwner IBCocoaTouchFramework IBFirstResponder IBCocoaTouchFramework 274 YES 274 {320, 460} 3 MSAwAA 2 IBCocoaTouchFramework {{0, 20}, {320, 460}} 3 MC4zMzMzMzMzMzMzAA NO IBCocoaTouchFramework YES view 7 carousel 9 dataSource 10 delegate 11 YES 0 YES -1 File's Owner -2 6 YES 8 YES iCarousel YES YES -1.CustomClassName -1.IBPluginDependency -2.CustomClassName -2.IBPluginDependency 6.IBPluginDependency 8.CustomClassName 8.IBPluginDependency YES iCarouselExampleViewController com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIResponder com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarousel com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES 34 YES iCarousel UIView YES YES dataSource delegate YES id id YES YES dataSource delegate YES dataSource id delegate id IBProjectSource ./Classes/iCarousel.h iCarouselExampleViewController UIViewController YES YES changedSlider: pressedButton: toggledSwitch: YES id id id YES YES changedSlider: pressedButton: toggledSwitch: YES changedSlider: id pressedButton: id toggledSwitch: id carousel iCarousel carousel carousel iCarousel IBProjectSource ./Classes/iCarouselExampleViewController.h 0 IBCocoaTouchFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 YES 3 933 ================================================ FILE: Examples/Tables Demo/iCarouselExampleAppDelegate.h ================================================ // // iCarouselExampleAppDelegate.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import @class iCarouselExampleViewController; @interface iCarouselExampleAppDelegate : NSObject @property (nonatomic, strong) IBOutlet UIWindow *window; @property (nonatomic, strong) IBOutlet iCarouselExampleViewController *viewController; @end ================================================ FILE: Examples/Tables Demo/iCarouselExampleAppDelegate.m ================================================ // // iCarouselExampleAppDelegate.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleAppDelegate.h" #import "iCarouselExampleViewController.h" @implementation iCarouselExampleAppDelegate @synthesize window; @synthesize viewController; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { window.rootViewController = viewController; [window makeKeyAndVisible]; return YES; } @end ================================================ FILE: Examples/Tables Demo/iCarouselExampleViewController.h ================================================ // // iCarouselExampleViewController.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import #import "iCarousel.h" @interface iCarouselExampleViewController : UIViewController @end ================================================ FILE: Examples/Tables Demo/iCarouselExampleViewController.m ================================================ // // iCarouselExampleViewController.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleViewController.h" @interface iCarouselExampleViewController () @property (nonatomic, strong) IBOutlet iCarousel *carousel; @end @implementation iCarouselExampleViewController - (void)dealloc { self.carousel.delegate = nil; self.carousel.dataSource = nil; } #pragma mark - #pragma mark View lifecycle - (void)viewDidLoad { [super viewDidLoad]; //configure carousel self.carousel.type = iCarouselTypeCoverFlow2; } - (void)viewDidUnload { [super viewDidUnload]; self.carousel = nil; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } #pragma mark - #pragma mark iCarousel methods - (NSInteger)numberOfItemsInCarousel:(iCarousel *)carousel { return 1000; } - (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view { UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 200, 200) style:UITableViewStylePlain]; tableView.dataSource = self; return tableView; } #pragma mark - #pragma mark Table methods - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 1000; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"]; if (!cell) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"]; } cell.textLabel.text = @"Hello World"; return cell; } @end ================================================ FILE: Examples/Tables Demo/iCarouselTest-Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleDisplayName ${PRODUCT_NAME} CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIconFile CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1.0 LSRequiresIPhoneOS NSMainNibFile MainWindow UIStatusBarHidden UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight ================================================ FILE: Examples/Tables Demo/iCarouselTest-Prefix.pch ================================================ // // Prefix header for all source files of the 'iCarouselExample' target in the 'iCarouselExample' project // #import #ifndef __IPHONE_3_0 #warning "This project uses features only available in iPhone SDK 3.0 and later." #endif #ifdef __OBJC__ #import #import #endif ================================================ FILE: Examples/Tables Demo/iCarouselTest.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 01308D9313491C3500453707 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9213491C3500453707 /* UIKit.framework */; }; 01308D9513491C3500453707 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9413491C3500453707 /* Foundation.framework */; }; 01308D9713491C3500453707 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9613491C3500453707 /* CoreGraphics.framework */; }; 01308DC013491F7200453707 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308DBF13491F7200453707 /* QuartzCore.framework */; }; 0148358813A36C2000E687AC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358313A36C2000E687AC /* main.m */; }; 0148359313A36C3700E687AC /* iCarouselExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */; }; 0148359413A36C3700E687AC /* iCarouselExampleAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */; }; 0148359513A36C3700E687AC /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0148358F13A36C3700E687AC /* MainWindow.xib */; }; 0148359613A36C3700E687AC /* iCarouselExampleViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */; }; 01C5BF7C17A43F8300B7B0BC /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 01C5BF7B17A43F8300B7B0BC /* Default-568h@2x.png */; }; B2E5E749146155E300EADB7A /* iCarousel.m in Sources */ = {isa = PBXBuildFile; fileRef = B2E5E748146155E300EADB7A /* iCarousel.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 01308D9213491C3500453707 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 01308D9413491C3500453707 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 01308D9613491C3500453707 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 01308DBF13491F7200453707 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 0148358313A36C2000E687AC /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = SOURCE_ROOT; }; 0148358413A36C2000E687AC /* iCarouselTest-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "iCarouselTest-Prefix.pch"; sourceTree = SOURCE_ROOT; }; 0148358513A36C2000E687AC /* iCarouselTest-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "iCarouselTest-Info.plist"; sourceTree = SOURCE_ROOT; }; 0148358713A36C2000E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = SOURCE_ROOT; }; 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleViewController.m; sourceTree = SOURCE_ROOT; }; 0148358C13A36C3700E687AC /* iCarouselExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleViewController.h; sourceTree = SOURCE_ROOT; }; 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleAppDelegate.m; sourceTree = SOURCE_ROOT; }; 0148358E13A36C3700E687AC /* iCarouselExampleAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleAppDelegate.h; sourceTree = SOURCE_ROOT; }; 0148359013A36C3700E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainWindow.xib; sourceTree = SOURCE_ROOT; }; 0148359213A36C3700E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/iCarouselExampleViewController.xib; sourceTree = SOURCE_ROOT; }; 018BBCB413A375AF005CA505 /* iCarouselTest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iCarouselTest.app; sourceTree = BUILT_PRODUCTS_DIR; }; 01C5BF7B17A43F8300B7B0BC /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = SOURCE_ROOT; }; B2E5E747146155E300EADB7A /* iCarousel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarousel.h; sourceTree = ""; }; B2E5E748146155E300EADB7A /* iCarousel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarousel.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 01308D8B13491C3500453707 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 01308DC013491F7200453707 /* QuartzCore.framework in Frameworks */, 01308D9313491C3500453707 /* UIKit.framework in Frameworks */, 01308D9513491C3500453707 /* Foundation.framework in Frameworks */, 01308D9713491C3500453707 /* CoreGraphics.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 01308D8313491C3500453707 = { isa = PBXGroup; children = ( B2E5E746146155E300EADB7A /* iCarousel */, 01308D9813491C3500453707 /* iCarouselTest */, 01308D9113491C3500453707 /* Frameworks */, 01308D8F13491C3500453707 /* Products */, ); sourceTree = ""; }; 01308D8F13491C3500453707 /* Products */ = { isa = PBXGroup; children = ( 018BBCB413A375AF005CA505 /* iCarouselTest.app */, ); name = Products; sourceTree = ""; }; 01308D9113491C3500453707 /* Frameworks */ = { isa = PBXGroup; children = ( 01308DBF13491F7200453707 /* QuartzCore.framework */, 01308D9213491C3500453707 /* UIKit.framework */, 01308D9413491C3500453707 /* Foundation.framework */, 01308D9613491C3500453707 /* CoreGraphics.framework */, ); name = Frameworks; sourceTree = ""; }; 01308D9813491C3500453707 /* iCarouselTest */ = { isa = PBXGroup; children = ( 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */, 0148358C13A36C3700E687AC /* iCarouselExampleViewController.h */, 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */, 0148358E13A36C3700E687AC /* iCarouselExampleAppDelegate.h */, 0148358F13A36C3700E687AC /* MainWindow.xib */, 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */, 01308D9913491C3500453707 /* Supporting Files */, ); name = iCarouselTest; path = iCarouselExample; sourceTree = ""; }; 01308D9913491C3500453707 /* Supporting Files */ = { isa = PBXGroup; children = ( 01C5BF7B17A43F8300B7B0BC /* Default-568h@2x.png */, 0148358313A36C2000E687AC /* main.m */, 0148358413A36C2000E687AC /* iCarouselTest-Prefix.pch */, 0148358513A36C2000E687AC /* iCarouselTest-Info.plist */, 0148358613A36C2000E687AC /* InfoPlist.strings */, ); name = "Supporting Files"; sourceTree = ""; }; B2E5E746146155E300EADB7A /* iCarousel */ = { isa = PBXGroup; children = ( B2E5E747146155E300EADB7A /* iCarousel.h */, B2E5E748146155E300EADB7A /* iCarousel.m */, ); name = iCarousel; path = ../../iCarousel; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 01308D8D13491C3500453707 /* iCarouselTest */ = { isa = PBXNativeTarget; buildConfigurationList = 01308DAF13491C3500453707 /* Build configuration list for PBXNativeTarget "iCarouselTest" */; buildPhases = ( 01308D8A13491C3500453707 /* Sources */, 01308D8B13491C3500453707 /* Frameworks */, 01308D8C13491C3500453707 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = iCarouselTest; productName = iCarouselExample; productReference = 018BBCB413A375AF005CA505 /* iCarouselTest.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 01308D8513491C3500453707 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0800; }; buildConfigurationList = 01308D8813491C3500453707 /* Build configuration list for PBXProject "iCarouselTest" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); mainGroup = 01308D8313491C3500453707; productRefGroup = 01308D8F13491C3500453707 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 01308D8D13491C3500453707 /* iCarouselTest */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 01308D8C13491C3500453707 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 0148359513A36C3700E687AC /* MainWindow.xib in Resources */, 0148359613A36C3700E687AC /* iCarouselExampleViewController.xib in Resources */, 01C5BF7C17A43F8300B7B0BC /* Default-568h@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 01308D8A13491C3500453707 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 0148358813A36C2000E687AC /* main.m in Sources */, 0148359313A36C3700E687AC /* iCarouselExampleViewController.m in Sources */, 0148359413A36C3700E687AC /* iCarouselExampleAppDelegate.m in Sources */, B2E5E749146155E300EADB7A /* iCarousel.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 0148358613A36C2000E687AC /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( 0148358713A36C2000E687AC /* en */, ); name = InfoPlist.strings; sourceTree = ""; }; 0148358F13A36C3700E687AC /* MainWindow.xib */ = { isa = PBXVariantGroup; children = ( 0148359013A36C3700E687AC /* en */, ); name = MainWindow.xib; sourceTree = ""; }; 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */ = { isa = PBXVariantGroup; children = ( 0148359213A36C3700E687AC /* en */, ); name = iCarouselExampleViewController.xib; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 01308DAD13491C3500453707 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = DEBUG; GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; }; name = Debug; }; 01308DAE13491C3500453707 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; SDKROOT = iphoneos; }; name = Release; }; 01308DB013491C3500453707 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselTest-Prefix.pch"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = "iCarouselTest-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = iCarouselTest; TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = app; }; name = Debug; }; 01308DB113491C3500453707 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselTest-Prefix.pch"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = "iCarouselTest-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = iCarouselTest; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; WRAPPER_EXTENSION = app; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 01308D8813491C3500453707 /* Build configuration list for PBXProject "iCarouselTest" */ = { isa = XCConfigurationList; buildConfigurations = ( 01308DAD13491C3500453707 /* Debug */, 01308DAE13491C3500453707 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 01308DAF13491C3500453707 /* Build configuration list for PBXNativeTarget "iCarouselTest" */ = { isa = XCConfigurationList; buildConfigurations = ( 01308DB013491C3500453707 /* Debug */, 01308DB113491C3500453707 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 01308D8513491C3500453707 /* Project object */; } ================================================ FILE: Examples/Tables Demo/main.m ================================================ // // main.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import int main(int argc, char *argv[]) { @autoreleasepool { int retVal = UIApplicationMain(argc, argv, nil, nil); return retVal; } } ================================================ FILE: LICENCE.md ================================================ iCarousel Copyright (C) 2011 Charcoal Design This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. ================================================ FILE: README.md ================================================ Purpose -------------- iCarousel is a class designed to simplify the implementation of various types of carousel (paged, scrolling views) on iPhone, iPad and Mac OS. iCarousel implements a number of common effects such as cylindrical, flat and "CoverFlow" style carousels, as well as providing hooks to implement your own bespoke effects. Unlike many other "CoverFlow" libraries, iCarousel can work with any kind of view, not just images, so it is ideal for presenting paged data in a fluid and impressive way in your app. It also makes it extremely easy to swap between different carousel effects with minimal code changes. Supported OS & SDK Versions ----------------------------- * Supported build target - iOS 10.0 / Mac OS 10.12 (Xcode 8.0, Apple LLVM compiler 8.0) * Earliest supported deployment target - iOS 5.0 / Mac OS 10.7 * Earliest compatible deployment target - iOS 4.3 / Mac OS 10.6 NOTE: 'Supported' means that the library has been tested with this version. 'Compatible' means that the library should work on this OS version (i.e. it doesn't rely on any unavailable SDK features) but is no longer being tested for compatibility and may require tweaking or bug fixes to run correctly. ARC Compatibility ------------------ As of version 1.8, iCarousel requires ARC. If you wish to use iCarousel in a non-ARC project, just add the -fobjc-arc compiler flag to the iCarousel.m class. To do this, go to the Build Phases tab in your target settings, open the Compile Sources group, double-click iCarousel.m in the list and type -fobjc-arc into the popover. If you wish to convert your whole project to ARC, comment out the #error line in iCarousel.m, then run the Edit > Refactor > Convert to Objective-C ARC... tool in Xcode and make sure all files that you wish to use ARC for (including iCarousel.m) are checked. Thread Safety -------------- iCarousel is derived from UIView and - as with all UIKit components - it should only be accessed from the main thread. You may wish to use threads for loading or updating carousel contents or items, but always ensure that once your content has loaded, you switch back to the main thread before updating the carousel. Installation -------------- To use the iCarousel class in an app, just drag the iCarousel class files (demo files and assets are not needed) into your project and add the QuartzCore framework. You can also install it using Cocoapods in the normal way. Chameleon Support ------------------- iCarousel is now compatible with the Chameleon iOS-to-Mac conversion library (https://github.com/BigZaphod/Chameleon). To use iCarousel with Chameleon, add `USING_CHAMELEON` to your project's preprocessor macros. Check out the *Chameleon Demo* example project for how to port your iOS iCarousel app to Mac OS using Chameleon - the example demonstrates how to run the No Nib iPhone example on Mac OS using Chameleon. Note that tap-to-center doesn't currently work, and scrolling must be done using a two-fingered scroll gesture, not click-and-drag (both of these are due to features/limitations of the Chameleon UIGestureRecognizer implementation). Carousel Types -------------- iCarousel supports the following built-in display types: - iCarouselTypeLinear - iCarouselTypeRotary - iCarouselTypeInvertedRotary - iCarouselTypeCylinder - iCarouselTypeInvertedCylinder - iCarouselTypeWheel - iCarouselTypeInvertedWheel - iCarouselTypeCoverFlow - iCarouselTypeCoverFlow2 - iCarouselTypeTimeMachine - iCarouselTypeInvertedTimeMachine You can also implement your own bespoke carousel styles using `iCarouselTypeCustom` and the `carousel:itemTransformForOffset:baseTransform:` delegate method. NOTE: The difference between `iCarouselTypeCoverFlow` and `iCarouselTypeCoverFlow2` types is quite subtle, however the logic for `iCarouselTypeCoverFlow2` is substantially more complex. If you flick the carousel they are basically identical, but if you drag the carousel slowly with your finger the difference should be apparent. `iCarouselTypeCoverFlow2` is designed to simulate the standard Apple CoverFlow effect as closely as possible and may change subtly in future in the interests of that goal. ## Display Type Visual Examples ---- ### Linear ![Linear](http://g.recordit.co/xt86iK3A7f.gif) ### Rotary ![Rotary](http://g.recordit.co/Z7DsqjjBY3.gif) ### Inverted Rotary ![Inverted Rotary](http://g.recordit.co/a8H2tsIw7A.gif) ### Cylinder ![Cylinder](http://g.recordit.co/TqlTGGoz37.gif) ### Inverted Cylinder ![Inverted Cylinder](http://g.recordit.co/Try1zdrBoW.gif) ### Wheel ![Wheel](http://recordit.co/oAyZbMlhXe) ### Inverted Wheel ![Inverted Wheel](http://g.recordit.co/IhFCxwgOig.gif) ### Cover Flow ![Cover Flow](http://g.recordit.co/Qp2E5Y6MAe.gif) ### Cover Flow2 ![Cover Flow2](http://g.recordit.co/m5tc1vAKMY.gif) ### Time Machine ![Time Machine](http://g.recordit.co/Ux40G7G0eW.gif) ### Inverted Time Machine ![Inverted Time Machine](http://g.recordit.co/F7N7nIT8Oh.gif) Properties -------------- The iCarousel has the following properties (note: for Mac OS, substitute NSView for UIView when using properties): @property (nonatomic, weak) IBOutlet id dataSource; An object that supports the iCarouselDataSource protocol and can provide views to populate the carousel. @property (nonatomic, weak) IBOutlet id delegate; An object that supports the iCarouselDelegate protocol and can respond to carousel events and layout requests. @property (nonatomic, assign) iCarouselType type; Used to switch the carousel display type (see above for details). @property (nonatomic, assign) CGFloat perspective; Used to tweak the perspective foreshortening effect for the various 3D carousel views. Should be a negative value, less than 0 and greater than -0.01. Values outside of this range will yield very strange results. The default is -1/500, or -0.005; @property (nonatomic, assign) CGSize contentOffset; This property is used to adjust the offset of the carousel item views relative to the center of the carousel. It defaults to CGSizeZero, meaning that the carousel items are centered. Changing this value moves the carousel items *without* changing their perspective, i.e. the vanishing point moves with the carousel items, so if you move the carousel items down, it *does not* appear as if you are looking down on the carousel. @property (nonatomic, assign) CGSize viewpointOffset; This property is used to adjust the user viewpoint relative to the carousel items. It has the opposite effect to adjusting the contentOffset, i.e. if you move the viewpoint up then the carousel appears to move down. Unlike the contentOffset, moving the viewpoint also changes the perspective vanishing point relative to the carousel items, so if you move the viewpoint up, it will appear as if you are looking down on the carousel. @property (nonatomic, assign) CGFloat decelerationRate; The rate at which the carousel decelerates when flicked. Higher values mean slower deceleration. The default value is 0.95. Values should be in the range 0.0 (carousel stops immediately when released) to 1.0 (carousel continues indefinitely without slowing down, unless it reaches the end). @property (nonatomic, assign) BOOL bounces; Sets whether the carousel should bounce past the end and return, or stop dead. Note that this has no effect on carousel types that are designed to wrap, or where the carouselShouldWrap delegate method returns YES. @property (nonatomic, assign) CGFloat bounceDistance; The maximum distance that a non-wrapped carousel will bounce when it overshoots the end. This is measured in multiples of the itemWidth, so a value of 1.0 would means the carousel will bounce by one whole item width, a value of 0.5 would be half an item's width, and so on. The default value is 1.0; @property (nonatomic, assign, getter = isScrollEnabled) BOOL scrollEnabled; Enables and disables user scrolling of the carousel. The carousel can still be scrolled programmatically if this property is set to NO. @property (nonatomic, readonly, getter = isWrapEnabled) BOOL wrapEnabled; Returns YES if wrapping is enabled and NO if it isn't. This property is read only. If you wish to override the default value, implement the `carousel:valueForOption:withDefault:` delegate method and return a value for `iCarouselOptionWrap`. @property (nonatomic, assign, getter = isPagingEnabled) BOOL pagingEnabled; Enables and disables paging. When paging is enabled, the carousel will stop at each item view as the user scrolls, much like the pagingEnabled property of a UIScrollView. @property (nonatomic, readonly) NSInteger numberOfItems; The number of items in the carousel (read only). To set this, implement the `numberOfItemsInCarousel:` dataSource method. Note that not all of these item views will be loaded or visible at a given point in time - the carousel loads item views on demand as it scrolls. @property (nonatomic, readonly) NSInteger numberOfPlaceholders; The number of placeholder views to display in the carousel (read only). To set this, implement the `numberOfPlaceholdersInCarousel:` dataSource method. @property (nonatomic, readonly) NSInteger numberOfVisibleItems; The maximum number of carousel item views to be displayed concurrently on screen (read only). This property is important for performance optimisation, and is calculated automatically based on the carousel type and view frame. If you wish to override the default value, implement the `carousel:valueForOption:withDefault:` delegate method and return a value for iCarouselOptionVisibleItems. @property (nonatomic, strong, readonly) NSArray *indexesForVisibleItems; An array containing the indexes of all item views currently loaded and visible in the carousel, including placeholder views. The array contains NSNumber objects whose integer values match the indexes of the views. The indexes for item views start at zero and match the indexes passed to the dataSource to load the view, however the indexes for any visible placeholder views will either be negative (less than zero) or greater than or equal to `numberOfItems`. Indexes for placeholder views in this array *do not* equate to the placeholder view index used with the dataSource. @property (nonatomic, strong, readonly) NSArray *visibleItemViews; An array of all the item views currently displayed in the carousel (read only). This includes any visible placeholder views. The indexes of views in this array do not match the item indexes, however the order of these views matches the order of the visibleItemIndexes array property, i.e. you can get the item index of a given view in this array by retrieving the equivalent object from the visibleItemIndexes array (or, you can just use the `indexOfItemView:` method, which is much easier). @property (nonatomic, strong, readonly) UIView *contentView; The view containing the carousel item views. You can add subviews to this view if you want to intersperse them with the carousel items. If you want a view to appear in front or behind all of the carousel items, you should add it directly to the iCarousel view itself instead. Note that the order of views inside the contentView is subject to frequent and undocumented change whilst the app is running. Any views added to the contentView should have their userInteractionEnabled property set to NO to prevent conflicts with iCarousel's touch event handling. @property (nonatomic, assign) CGFloat scrollOffset; This is the current scroll offset of the carousel in multiples of the itemWidth. This value, rounded to the nearest integer, is the currentItemIndex value. You can use this value to position other screen elements while the carousel is in motion. The value can also be set if you wish to scroll the carousel to a particular offset programmatically. This may be useful if you wish to disable the built-in gesture handling and provide your own implementation. @property (nonatomic, readonly) CGFloat offsetMultiplier; This is the offset multiplier used when the user drags the carousel with their finger. It does not affect programmatic scrolling or deceleration speed. This defaults to 1.0 for most carousel types, but defaults to 2.0 for the CoverFlow-style carousels to compensate for the fact that their items are more closely spaced and so must be dragged further to move the same distance. You cannot set this property directly, but you can override the default value by implementing the `carouselOffsetMultiplier:` delegate method. @property (nonatomic, assign) NSInteger currentItemIndex; The index of the currently centered item in the carousel. Setting this property is equivalent to calling `scrollToItemAtIndex:animated:` with the animated argument set to NO. @property (nonatomic, strong, readonly) UIView *currentItemView; The currently centered item view in the carousel. The index of this view matches `currentItemIndex`. @property (nonatomic, readonly) CGFloat itemWidth; The display width of items in the carousel (read only). This is derived automatically from the first view passed in to the carousel using the `carousel:viewForItemAtIndex:reusingView:` dataSource method. You can also override this value using the `carouselItemWidth:` delegate method, which will alter the space allocated for carousel items (but won't resize or scale the item views). @property (nonatomic, assign) BOOL centerItemWhenSelected; When set to YES, tapping any item in the carousel other than the one matching the currentItemIndex will cause it to smoothly animate to the center. Tapping the currently selected item will have no effect. Defaults to YES. @property (nonatomic, assign) CGFloat scrollSpeed; This is the scroll speed multiplier when the user flicks the carousel with their finger. Defaults to 1.0. @property (nonatomic, readonly) CGFloat toggle; This property is used for the `iCarouselTypeCoverFlow2` carousel transform. It is exposed so that you can implement your own variants of the CoverFlow2 style using the `carousel:itemTransformForOffset:baseTransform:` delegate method. @property (nonatomic, assign) BOOL stopAtItemBoundary; By default, the carousel will come to rest at an exact item boundary when it is flicked. If you set this property to NO, it will stop naturally and then - if scrollToItemBoundary is set to YES - scroll back or forwards to the nearest boundary. @property (nonatomic, assign) BOOL scrollToItemBoundary; By default whenever the carousel stops moving it will automatically scroll to the nearest item boundary. If you set this property to NO, the carousel will not scroll after stopping and will stay wherever it is, even if it's not perfectly aligned on the current index. The exception to this is that if wrapping is disabled and `bounces` is set to YES then regardless of this setting, the carousel will automatically scroll back to the first or last item index if it comes to rest beyond the end of the carousel. @property (nonatomic, assign, getter = isVertical) BOOL vertical; This property toggles whether the carousel is displayed horizontally or vertically on screen. All the built-in carousel types work in both orientations. Switching to vertical changes both the layout of the carousel and also the direction of swipe detection on screen. Note that custom carousel transforms are not affected by this property, however the swipe gesture direction will still be affected. @property (nonatomic, readonly, getter = isDragging) BOOL dragging; Returns YES if user has started scrolling the carousel and has not yet released it. @property (nonatomic, readonly, getter = isDecelerating) BOOL decelerating; Returns YES if the user isn't dragging the carousel any more, but it is still moving. @property (nonatomic, readonly, getter = isScrolling) BOOL scrolling; Returns YES if the carousel is currently being scrolled programatically. @property (nonatomic, assign) BOOL ignorePerpendicularSwipes; If YES, the carousel will ignore swipe gestures that are perpendicular to the orientation of the carousel. So for a horizontal carousel, vertical swipes will not be intercepted. This means that you can have a vertically scrolling scrollView inside a carousel item view and it will still function correctly. Defaults to YES. @property (nonatomic, assign) BOOL clipsToBounds; This is actually not a property of iCarousel but is inherited from UIView. It's included here because it's a frequently missed feature. Set this to YES to prevent the carousel item views overflowing their bounds. You can set this property in Interface Builder by ticking the 'Clip Subviews' option. Defaults to NO. @property (nonatomic, assign) CGFloat autoscroll; This property can be used to set the carousel scrolling at a constant speed. A value of 1.0 would scroll the carousel forwards at a rate of one item per second. The autoscroll value can be positive or negative and defaults to 0.0 (stationary). Autoscrolling will stop if the user interacts with the carousel, and will resume when they stop. Methods -------------- The iCarousel class has the following methods (note: for Mac OS, substitute NSView for UIView in method arguments): - (void)scrollToItemAtIndex:(NSInteger)index animated:(BOOL)animated; This will center the carousel on the specified item, either immediately or with a smooth animation. For wrapped carousels, the carousel will automatically determine the shortest (direct or wraparound) distance to scroll. If you need to control the scroll direction, or want to scroll by more than one revolution, use the scrollByNumberOfItems method instead. - (void)scrollToItemAtIndex:(NSInteger)index duration:(NSTimeInterval)scrollDuration; This method allows you to control how long the carousel takes to scroll to the specified index. - (void)scrollByNumberOfItems:(NSInteger)itemCount duration:(NSTimeInterval)duration; This method allows you to scroll the carousel by a fixed distance, measured in carousel item widths. Positive or negative values may be specified for itemCount, depending on the direction you wish to scroll. iCarousel gracefully handles bounds issues, so if you specify a distance greater than the number of items in the carousel, scrolling will either be clamped when it reaches the end of the carousel (if wrapping is disabled) or wrap around seamlessly. - (void)scrollToOffset:(CGFloat)offset duration:(NSTimeInterval)duration; This works the same way as `scrollToItemAtIndex:`, but allows you to scroll to a fractional offset. This may be useful if you wish to achieve a very precise animation effect. Note that if the `scrollToItemBoundary` property is set to YES, the carousel will automatically scroll to the nearest item index after you call this method. anyway. - (void)scrollByOffset:(CGFloat)offset duration:(NSTimeInterval)duration; This works the same way as `scrollByNumberOfItems:`, but allows you to scroll by a fractional number of items. This may be useful if you wish to achieve a very precise animation effect. Note that if the `scrollToItemBoundary` property is set to YES, the carousel will automatically scroll to the nearest item index after you call this method anyway. - (void)reloadData; This reloads all carousel views from the dataSource and refreshes the carousel display. - (UIView *)itemViewAtIndex:(NSInteger)index; Returns the visible item view with the specified index. Note that the index relates to the position in the carousel, and not the position in the `visibleItemViews` array, which may be different. Pass a negative index or one greater than or equal to `numberOfItems` to retrieve placeholder views. The method only works for visible item views and will return nil if the view at the specified index has not been loaded, or if the index is out of bounds. - (NSInteger)indexOfItemView:(UIView *)view; The index for a given item view in the carousel. Works for item views and placeholder views, however placeholder view indexes do not match the ones used by the dataSource and may be negative (see `indexesForVisibleItems` property above for more details). This method only works for visible item views and will return NSNotFound for views that are not currently loaded. For a list of all currently loaded views, use the `visibleItemViews` property. - (NSInteger)indexOfItemViewOrSubview:(UIView *)view This method gives you the item index of either the view passed or the view containing the view passed as a parameter. It works by walking up the view hierarchy starting with the view passed until it finds an item view and returns its index within the carousel. If no currently-loaded item view is found, it returns NSNotFound. This method is extremely useful for handling events on controls embedded within an item view. This allows you to bind all your item controls to a single action method on your view controller, and then work out which item the control that triggered the action was related to. You can see an example of this technique in the *Controls Demo* example project. - (CGFloat)offsetForItemAtIndex:(NSInteger)index; Returns the offset for the specified item index in multiples of `itemWidth` from the center position. This is the same value used for calculating the view transform and alpha, and can be used to customise item views based on their position in the carousel. This value can be expected to change for each view whenever the `carouselDidScroll:` delegate method is called. - (UIView *)itemViewAtPoint:(CGPoint)point; Returns the frontmost item view at the specified point within the bounds of the carousel. Useful for implementing your own tap detection. - (void)removeItemAtIndex:(NSInteger)index animated:(BOOL)animated; This removes an item from the carousel. The remaining items will slide across to fill the gap. Note that the data source is not automatically updated when this method is called, so a subsequent call to reloadData will restore the removed item. - (void)insertItemAtIndex:(NSInteger)index animated:(BOOL)animated; This inserts an item into the carousel. The new item will be requested from the dataSource, so make sure that the new item has been added to the data source data before calling this method, or you will get duplicate items in the carousel, or other weirdness. - (void)reloadItemAtIndex:(NSInteger)index animated:(BOOL)animated; This method will reload the specified item view. The new item will be requested from the dataSource. If the animated argument is YES, it will cross-fade from the old to the new item view, otherwise it will swap instantly. Protocols --------------- The iCarousel follows the Apple convention for data-driven views by providing two protocol interfaces, iCarouselDataSource and iCarouselDelegate. The iCarouselDataSource protocol has the following required methods (note: for Mac OS, substitute NSView for UIView in method arguments): - (NSUInteger)numberOfItemsInCarousel:(iCarousel *)carousel; Return the number of items (views) in the carousel. - (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index reusingView:(UIView *)view; Return a view to be displayed at the specified index in the carousel. The `reusingView` argument works like a UIPickerView, where views that have previously been displayed in the carousel are passed back to the method to be recycled. If this argument is not nil, you can set its properties and return it instead of creating a new view instance, which will slightly improve performance. Unlike UITableView, there is no reuseIdentifier for distinguishing between different carousel view types, so if your carousel contains multiple different view types then you should just ignore this parameter and return a new view each time the method is called. You should ensure that each time the `carousel:viewForItemAtIndex:reusingView:` method is called, it either returns the reusingView or a brand new view instance rather than maintaining your own pool of recyclable views, as returning multiple copies of the same view for different carousel item indexes may cause display issues with the carousel. The iCarouselDataSource protocol has the following optional methods: - (NSUInteger)numberOfPlaceholdersInCarousel:(iCarousel *)carousel; Returns the number of placeholder views to display in the carousel. Placeholder views are intended to be used when the number of items in the carousel is too few to fill the carousel width, and you wish to display something in the empty space. They move with the carousel and behave just like any other carousel item, but they do not count towards the numberOfItems value, and cannot be set as the currently selected item. Placeholders are hidden when wrapping is enabled. Placeholders appear on either side of the carousel items. For n placeholder views, the first n/2 items will appear to the left of the item views and the next n/2 will appear to the right. You can have an odd number of placeholders, in which case the carousel will be asymmetrical. - (UIView *)carousel:(iCarousel *)carousel placeholderViewAtIndex:(NSUInteger)index reusingView:(UIView *)view; Return a view to be displayed as the placeholder view. Works the same way as `carousel:viewForItemAtIndex:reusingView:`. Placeholder reusingViews are stored in a separate pool to the reusingViews used for regular carousel, so it's not a problem if your placeholder views are different to the item views. The iCarouselDelegate protocol has the following optional methods: - (void)carouselWillBeginScrollingAnimation:(iCarousel *)carousel; This method is called whenever the carousel will begin an animated scroll. This can be triggered programatically or automatically after the user finishes scrolling the carousel, as the carousel re-aligns itself. - (void)carouselDidEndScrollingAnimation:(iCarousel *)carousel; This method is called when the carousel ends an animated scroll. - (void)carouselDidScroll:(iCarousel *)carousel; This method is called whenever the carousel is scrolled. It is called regardless of whether the carousel was scrolled programatically or through user interaction. - (void)carouselCurrentItemIndexDidChange:(iCarousel *)carousel; This method is called whenever the carousel scrolls far enough for the currentItemIndex property to change. It is called regardless of whether the item index was updated programatically or through user interaction. - (void)carouselWillBeginDragging:(iCarousel *)carousel; This method is called when the user begins dragging the carousel. It will not fire if the user taps/clicks the carousel, or if the carousel is scrolled programmatically. - (void)carouselDidEndDragging:(iCarousel *)carousel willDecelerate:(BOOL)decelerate; This method is called when the user stops dragging the carousel. The willDecelerate parameter indicates whether the carousel is travelling fast enough that it needs to decelerate before it stops (i.e. the current index is not necessarily the one it will stop at) or if it will stop where it is. Note that even if willDecelerate is NO, the carousel will still scroll automatically until it aligns exactly on the current index. If you need to know when it has stopped moving completely, use the carouselDidEndScrollingAnimation delegate method. - (void)carouselWillBeginDecelerating:(iCarousel *)carousel; This method is called when the carousel starts decelerating. it will typically be called immediately after the carouselDidEndDragging:willDecelerate: method, assuming willDecelerate was YES. - (void)carouselDidEndDecelerating:(iCarousel *)carousel; This method is called when the carousel finishes decelerating and you can assume that the currentItemIndex at this point is the final stopping value. Unlike previous versions, the carousel will now stop exactly on the final index position in most cases. The only exception is on non-wrapped carousels with bounce enabled, where, if the final stopping position is beyond the end of the carousel, the carousel will then scroll automatically until it aligns exactly on the end index. For backwards compatibility, the carousel will always call `scrollToItemAtIndex:animated:` after it finishes decelerating. If you need to know for certain when the carousel has stopped moving completely, use the `carouselDidEndScrollingAnimation` delegate method. - (CGFloat)carouselItemWidth:(iCarousel *)carousel; Returns the width of each item in the carousel - i.e. the spacing for each item view. If the method is not implemented, this defaults to the width of the first item view that is returned by the `carousel:viewForItemAtIndex:reusingView:` dataSource method. This method should only be used to crop or pad item views if the views returned from `carousel:viewForItemAtIndex:reusingView:` are not correct (e.g. if the views are differing sizes, or include a drop shadow or outer glow in their background image that affects their size) - if you just want to space out the views a bit then it's better to use the `iCarouselOptionSpacing` value instead. - (CATransform3D)carousel:(iCarousel *)carousel itemTransformForOffset:(CGFloat)offset baseTransform:(CATransform3D)transform; This method can be used to provide a custom transform for each carousel view. The offset argument is the distance of the view from the middle of the carousel. The currently centred item view would have an offset of 0.0, the one to the right would have an offset value of 1.0, the one to the left an offset value of -1.0, and so on. To implement the linear carousel style, you would therefore simply multiply the offset value by the item width and use it as the x value of the transform. This method is only called if the carousel type is iCarouselTypeCustom. - (CGFloat)carousel:(iCarousel *)carousel valueForOption:(iCarouselOption)option withDefault:(CGFloat)value; This method is used to customise the parameters of the standard carousel types. By implementing this method, you can tweak options such as the number of items displayed in a circular carousel, or the amount of tilt in a coverflow carousel, as well as whether the carousel should wrap and if it should fade out at the ends, etc. For any option you are not interested in tweaking, just return the default value. The meaning of these options is listed below under *iCarouselOption values*. Check the *Options Demo* for an advanced example of using this method. - (void)carousel:(iCarousel *)carousel didSelectItemAtIndex:(NSInteger)index; This method will fire if the user taps any carousel item view (not including placeholder views), including the currently selected view. This method will not fire if the user taps a control within the currently selected view (i.e. any view that is a subclass of UIControl). - (BOOL)carousel:(iCarousel *)carousel shouldSelectItemAtIndex:(NSInteger)index; This method will fire if the user taps any carousel item view (not including placeholder views), including the currently selected view. The purpose of a method is to give you the opportunity to ignore a tap on the carousel. If you return YES from the method, or don't implement it, the tap will be processed as normal and the `carousel:didSelectItemAtIndex:` method will be called. If you return NO, the carousel will ignore the tap and it will continue to propagate up the view hierarchy. This is a good way to prevent the carousel intercepting tap events intended for processing by another view. iCarouselOption values ---------------------------- These are the tweakable options for standard carousels. Check the *Options Demo* for an example of the effect that these parameters have. iCarouselOptionWrap A boolean indicating whether the carousel should wrap when it scrolls to the end. Return YES if you want the carousel to wrap around when it reaches the end, and NO if you want it to stop. Generally, circular carousel types will wrap by default and linear ones won't. Don't worry that the return type is a floating point value - any value other than 0.0 will be treated as YES. iCarouselOptionShowBackfaces For some carousel types, e.g. iCarouselTypeCylinder, the rear side of some views can be seen (iCarouselTypeInvertedCylinder now hides the back faces by default). If you wish to hide the backward-facing views you can return NO for this option. To override the default back-face hiding for the iCarouselTypeInvertedCylinder, you can return YES. This option may also be useful for custom carousel transforms that cause the back face of views to be displayed. iCarouselOptionOffsetMultiplier The offset multiplier to use when the user drags the carousel with their finger. It does not affect programmatic scrolling or deceleration speed. This defaults to 1.0 for most carousel types, but defaults to 2.0 for the CoverFlow-style carousels to compensate for the fact that their items are more closely spaced and so must be dragged further to move the same distance. iCarouselOptionVisibleItems This is the maximum number of item views (including placeholders) that should be visible in the carousel at once. Half of this number of views will be displayed to either side of the currently selected item index. Views beyond that will not be loaded until they are scrolled into view. This allows for the carousel to contain a very large number of items without adversely affecting performance. iCarousel chooses a suitable default value based on the carousel type, however you may wish to override that value using this property (e.g. if you have implemented a custom carousel type). iCarouselOptionCount The number of items to be displayed in the Rotary, Cylinder and Wheel transforms. Normally this is calculated automatically based on the view size and number of items in the carousel, but you can override this if you want more precise control of the carousel appearance. This property is used to calculate the carousel radius, so another option is to manipulate the radius directly. iCarouselOptionArc The arc of the Rotary, Cylinder and Wheel transforms (in radians). Normally this defaults to 2*M_PI (a complete circle) but you can specify a smaller value, so for example a value of M_PI will create a half-circle or cylinder. This property is used to calculate the carousel radius and angle step, so another option is to manipulate those values directly. iCarouselOptionRadius The radius of the Rotary, Cylinder and Wheel transforms in pixels/points. This is usually calculated so that the number of visible items exactly fits into the specified arc. You can manipulate this value to increase or reduce the item spacing (and the radius of the circle). iCarouselOptionAngle The angular step between each item in the Rotary, Cylinder and Wheel transforms (in radians). Manipulating this value without changing the radius will cause a gap at the end of the carousel or cause the items to overlap. iCarouselOptionTilt The tilt applied to the non-centered items in the CoverFlow, CoverFlow2 and TimeMachine carousel types. This value should be in the range 0.0 to 1.0. iCarouselOptionSpacing The spacing between item views. This value is multiplied by the item width (or height, if the carousel is vertical) to get the total space between each item, so a value of 1.0 (the default) means no space between views (unless the views already include padding, as they do in many of the example projects). iCarouselOptionFadeMin iCarouselOptionFadeMax iCarouselOptionFadeRange iCarouselOptionFadeMinAlpha These four options control the fading out of carousel item views based on their offset from the currently centered item. FadeMin is the minimum negative offset an item view can reach before it begins to fade. FadeMax is the maximum positive offset a view can reach before if begins to fade. FadeRange is the distance over which the fadeout occurs, measured in multiples of an item width (defaults to 1.0), and FadeMinAlpha is the minimum alpha value to which the views will fade (defaults to 0.0 - fully transparent). Detecting Taps on Item Views ---------------------------- There are two basic approaches to detecting taps on views in iCarousel on iOS. The first approach is to simply use the `carousel:didSelectItemAtIndex:` delegate method, which fires every time an item is tapped. If you are only interested in taps on the currently centered item, you can compare the `currentItemIndex` property against the index parameter of this method. Alternatively, if you want a little more control you can supply a UIButton or UIControl as the item view and handle the touch interactions yourself. See the *Buttons Demo* example project for an example of how this is done (doesn't work on Mac OS; see below). You can also nest UIControls within your item views and these will receive touches as expected (see the *Controls Demo* example project for an example). If you wish to detect other types of interaction such as swipes, double taps or long presses, the simplest way is to attach a UIGestureRecognizer to your item view or its subviews before passing it to the carousel. Note that taps and gestures will be ignored on any item view except the currently selected one, unless you set the `centerItemWhenSelected` property to NO. On Mac OS there is no easy way to embed controls within iCarousel item views currently. You cannot just supply an NSButton as or inside your item view because the transforms applied to the item views mean that hit detection doesn't work properly. I'm investigating possible solutions to this (if you know a good way to fix this, please get in touch, or fork the project on github). Example projects ------------------ iCarousel includes a number of example projects to help you get started. Here is a lift and brief description for each: Basic iOS Example This is a very simple example for iOS that demonstrates setting up a carousel with the iCarouselCoverflow2 type. iOS Demo This is a more complex iOS demo app that shows off all the different carousel types and additional features such as dynamic insertion/deletion of items. Mac Demo This is a Mac OS port of the iOS Demo example, which replicates all the same functionality. Buttons Demo This example demonstrates how to use UIButtons as your item views on iOS and correctly handle the events. Controls Demo This example demonstrates how to nest controls within your item views on iOS and correctly handle the events, as well as how to load complex item views from a nib file instead of generating them in code. Multiple Carousels This example demonstrates how to use multiple carousels within a single view controller. No Nib Demo This example demonstrates how to set up iCarousel without using a nib file on iOS. Storyboard Demo This example demonstrates how to set up iCarousel using Storyboards on iOS 5 and above. Offsets Demo This example demonstrates how to use the `contentOffset` and `viewpointOffset` properties, and the effect they have. Options Demo This example demonstrates how to customise the appearance of each carousel type using the iCarouselOption API. Fading Demo This example demonstrates how to use the iCarouselOption API to implement a nice looking fade out effect at the edges of the carousel. Dynamic View Reflections This example demonstrates how to use the ReflectionView class (https://github.com/nicklockwood/ReflectionView) to dynamically generate reflections for your item views. This is applicable to item views that contain subviews or controls. For item views that are just images, it's better to use the approach shown in the *Dynamic Image Effects* example. Dynamic Image Effects This example demonstrates how to use the FXImageView class (https://github.com/nicklockwood/FXImageView) to dynamically generate reflections and drop shadows for your carousel images. Dynamic Downloads This example demonstrates how to use the AsyncImageView class (https://github.com/nicklockwood/AsyncImageView) to dynamically download remote images and display them in a carousel without blocking the main thread or negatively affecting performance. Downloads & Effects This example demonstrates how to use the FXImageView class (https://github.com/nicklockwood/FXImageView) to download images on the fly and apply reflections and drop shadows to them in real time. Swift Example This example demonstrates how to use iCarousel with Swift instead of Objective-C. Tables Demo This example demonstrates how to use UITableViews inside your iCarousel item views and connect up the datasources without needing to use container controllers. FAQ ------------ Q. Does iCarousel support Swift? A. Yes, check out Swift Example and Swift3 Example projects. Q. I upgraded to the new version of iCarousel and it broke my project, how do I get the old one back? A. Every previous release of iCarousel is tagged as a separate download on github - look in the tags tab. Q. Can I use iCarousel without a nib file? A. Yes, check out the *No Nib Demo* for how to set up iCarousel without nibs Q. Can I use iCarousel with a Storyboard? A. Yes, this is pretty much the same as using it with a nib file. Check out the *Storyboard Demo* to see how it's done. Q. How do I prevent iCarousel item views from overflowing their bounds? A. Set the `clipsToBounds` property to YES on your iCarousel view. You can set this property in Interface Builder by ticking the 'Clip Subviews' option. Q. I'm getting weird issues where views turn up at the wrong points in the carousel. What's going on? A. You're probably recycling views in your `carousel:viewForItemAtIndex:reusingView:` using the `reusingView` parameter without setting the view contents each time. Study the demo app more closely and make sure you aren't doing all your item view setup in the wrong place. Q. I'm loading 50 images in my carousel and I keep running out of memory. How can I fix it? A. The trick is to load the views on a background thread as the carousel is scrolling instead of loading them all in advance. Check out the *Dynamic Downloads* example for how to do this using the AsyncImageView library. The example is using remote image URLs, but the exact same approach will work just as well for locally hosted images in your app - just create local file URLs using `[NSURL fileUrlWithPath:...]`. Q. Can I use multiple carousels in the same view controller? A. Yes, check out the *Multiple Carousels* example for how to do this. Q. I can't figure out how to use iCarousel in my project, is there a simple example? A. Yes, check out the *Basic iOS Example* project for a bare-bones implementation. If you're still not clear what's going on, read up about how UITableView works, and once you understand that, iCarousel will make more sense. Q. In the iCarouselTypeCylinder carousel, the back-side of the item views is visible. How can I hide these views? A. You can either return NO as the value for the `iCarouselOptionShowBackfaces` option, or set the `view.layer.doubleSided` property of your item views to `NO` to hide them when they are facing backwards. Q. What is the `reusingView` property for in the `carousel:viewForItemAtIndex:reusingView:` dataSource method? A. You can improve iCarousel performance by recycling item views when they move offscreen instead of creating a new one each time it's needed. Check if this value is nil, and if not you can re-use this view instead of creating a new one. Note however that the view will still have any subviews or properties you added when it was first created, so be careful not to introduce leaks by re-adding those views each time. You may find it's easier and safer to ignore this paramater and create a fresh view each time if you're not sure what you are doing. Q. If the views in my carousel all have completely different layouts, should I still use the `reusingView` parameter? A. Probably not, and unless you have hundreds of views in your carousel, it's unlikely to be worth the trouble. Q. How can I make iCarousel behave like a UIScrollView with paging enabled? A. As of version 1.8, iCarousel has a pagingEnabled property that emulates the behaviour of a UIScrollView (see the *Paging Example* project). The bounce physics are not quite the same though, and you may want to consider using the SwipeView library instead (https://github.com/nicklockwood/SwipeView) which is very similar to iCarousel, but based on a UIScrollView under the hood. Q. I want my carousel items to have a real reflection, but the reflection in the examples is just drawn on. How can I render reflections dynamically? A. iCarousel doesn't have built-in reflection support, but you can use some additional libraries to do this. Check out the *Dynamic View Reflections* and *Dynamic Image Effects* examples. Q. I want to download a bunch of images on the fly and display them in my carousel. How can I do that? A. Downloading images asynchronously and displaying them is quite complex. You can use my AsyncImageView library to simplify the process. Check out the *Dynamic Downloads* example. Q. What if I want to download images on the fly *and* add a reflection? Can I combine the ReflectionView and AsyncImageView classes? A. Technically yes, but if you are downloading images you'd be better off using the FXImageView class instead of ReflectionView. Check out the *Downloads & Reflections* example. Q. The edges of my item views look jaggy. Is there any way to smooth/antialias them? A. If you include (at least) a single pixel of transparent space around the edge of your item view images then iOS will smooth them automatically. This is because iOS automatically antialiases the pixels inside images, but doesn't antialias the edges of views. Even if your item views are a flat color, it's worth adding a background image of the same color to the views in order to get the smoothing effect. Release Notes ---------------- Version 1.8.3 - Fixed warnings and updated examples for Xcode 8 - Added Swift 3 example Version 1.8.2 - Fixed some warnings and updated examples for Xcode 7 beta - Scrolling now goes the right way when using Chameleon - Added nullability qualifiers to improve Swift interop Version 1.8.1 - Fixed bug where item views could be left invible after reloading Version 1.8 - iCarousel now requires ARC - iCarousel now requires 64-bit processors on Mac OS 10.6 - Added autoscroll property to set carousel rotating at a constant speed - Added pagingEnabled property to force carousel to only move a single index per swipe - Added itemViewAtPoint: method - Fixed bug which occasionally caused carousel item views to pop-in from right - Fixed bug where views with userInteractionEnabled = NO would get re-enabled - Removed all deprecated methods and APIs - Added iCarouselOptionFadeMinAlpha option for setting minimum fade - Setting scrollOffset now lets you exactly mirror behaviour from one carousel to another - Fixed bug where item indexes were selected incorrectly when tapping views in vertical mode - Perspective and viewpointOffset properties can now be animated - Added some minimal accessibility support - Single items now bounce by default (set scrollEnabled = NO to disable) - Now conforms to the -Weverything warning level Version 1.7.6 - Fixed animation timer bug when using ARC Version 1.7.5 - Fixed an issue with latest llvm compiler - Fixed conflict between iCarousel animation and UIScrollView scrolling Version 1.7.4 - Fixed deprecation warnings when using Xcode 4.6 - Fixed wide items in a vertical carousel getting incorrect hitboxes - Added podspec file Version 1.7.3 - Moved ARCHelper macros into .m file to avoid affecting other classes Version 1.7.2 - Core animation is no longer disabled when calling delegate methods. - Fixed a potential divide-by-zero error when scrolling - Removed useDisplayLink option as the performance benefits are unclear - Added dragging, scrolling and decelerating properties (readonly) - iCarouselWrap property is now refreshed after inserting/deleting items - Added Autoscrolling Example - Added Fading Demo example Version 1.7.1 - Fixed issue where reloading carousel with fewer items could sometimes crash - Fixed issue where scrollToItemAtIndex:duration: method would sometimes scroll to the wrong index Version 1.7 - Renamed iCarouselTransformOption... values to "iCarouselOption", and extended the list of available options - Simplified carousel interface by deprecating a number of delegate methods in favour of the simpler iCarouselOption API - numberOfVisibleItems is now calculated automatically - Added Dynamic Downloads example using AsyncImageView - Added Dynamic Effects examples using FXImageView - Item view interaction area is now more precisely set on iOS - Fixed backface interaction issue for iCarouselTypeInvertedCylinder - It is now much simpler to implement alpha fading logic based on item offset - Now supports item click events and centering on Mac OS (buttons and controls within item views still won't work correctly receive clicks however). - Added scrollToOffset: and scrollByOffset: methods - Disabled broken scrollwheel support for carousel on Mac OS - currentItemIndex property is now writable - scrollOffset property is now writable - Fixed bug with scrollByNumberOfItems where duration is 0 - Switched CADisplayLink to use NSDefaultRunLoopMode, which is less likely to interfere with UIScrollViews, etc - Added Storyboard example Version 1.6.3 - Added offsetForItemAtIndex: method - Fixed bug in reloadItemViewAtIndex:animated: method - Fixed Mac OS scrolling glitch when using numberOfVisibleViews - iCarousel now respects the layer.doubleSided property of item views - Added Basic and Multiple Carousels example projects Version 1.6.2 - Fixed long-standing viewpointOffset bug - Fixed potential bug around not setting default carousel type - LLVM GCC compiler is no longer supported, Now requires Apple LLVM compiler - Upgraded to latest ARC Helper code Version 1.6.1 - Added automatic support for ARC compile targets - Now compiles correctly again under LLVM GCC 4.2 - Vertical Time Machine carousel is now right-way-up on Mac OS - Added Inverted Time Machine carousel type - Added dynamic reflections example - Fixed crashing bug in examples on iPad - Carousels now behave better with 1 or 2 items Version 1.6 - Added support for item view recycling - Carousels can now be either horizontal or vertical - Added Wheel and Time Machine carousel types - Added new iCarouselTransformOption system for tweaking the standard carousel transforms without having to provide a completely bespoke implementation - Added ignorePerpendicularSwipes property - Fixed issue with scrolling immediately after reloading - Added useDisplayLink toggle to manually force use of NSTimer - Added support for the Chameleon iOS-to-Mac porting library - Removed the deprecated visibleViews property - Added carousel:alphaForViewAtItemWithOffset: delegate method for controlling view opacity - Added indexOfItemViewOrSubview: method to simplify handling of controls within carousel item views - Deprecated/renamed some dataSource and delegate methods - check your projects for compatibility - Expanded examples and tests Version 1.5.8 - Fixed bug in previous UITableCell fix - No longer gets stuck at a negative offset when inserting items into an empty carousel - Example app no longer crashes when inserting item into empty carousel - Better behaviour when reloading carousel Version 1.5.7 - Fixed ARC compatibility issues with sorting logic - UISwitches, UISliders and UITableCells now work correctly with item views - Fixed bug in carousel:shouldSelectItemAtIndex: delegate logic Version 1.5.6 - Added reloadItemAtIndex:animated: method. - Fixed some issues when setting offset or carousel bounds on the fly. - Less aggressive use of [CATransaction setDisableActions:YES] means more properties of carousel are now animatable (including setting the type). - Fixed NaN bug when displaying an empty carousel - Fixed glitch when programatically scrolling CoverFlow2-type carousel. - Cylinder and rotary carousel are now sized to fit visible number of items. Version 1.5.5 - Deprecated visibleViews property - Added visibleItemViews property, which is an array - Added indexesForVisibleItems property - Added itemViewAtIndex: method - Added currentItemView property - Added indexOfItemView: method - Fixed glitch when unwrapped CoverFlow2-type carousels reach the far right - Scroll animation events are now called immediately after scrolling ends if the carousel does not need to scroll a significant distance. - Fixed jerky bounce animation on CoverFlow2-type carousels when stopAtItemBoundary is set to NO. Version 1.5.4 - Fixed a bug where insertItemAtIndex method would not allow items to be inserted at the rightmost end of the carousel. Version 1.5.3 - Fixed a bug on wrapped carousels when the total number of carousel items exceeds the number of visible items. - Changed numberOfVisibleItems property to be a dataSource method, removing the arbitrary default limit of 21. - Fixed a flickering issue on CoverFlow2 carousel type. - Fixed bug on Mac where clicking would spin the carousel a random distance. - scrollSpeed is now a read/write property, and only affects speed when carousel is flicked. - Removed `carouselScrollSpeed` delegate method and replaced it with new `offsetMultiplier` property and `carouselOffsetMultiplier` delegate method to control the offset when dragging. - scrollOffset property is now public (readonly). - Floating point arguments and properties are now CGFloats instead of floats. Version 1.5.2 - Added bounceDistance property for finer control over bounce behaviour. - Added `carousel:shouldSelectItemAtIndex:` delegate method to allow carousel to selectively ignore taps. - Added `stopAtItemBoundary` and `scrollToItemBoundary` properties. - Fixed issue with carousel wrapping unexpectedly when wrapping and bouncing are disabled. - Fixed issue with rightmost visible view sometimes not loading. - Improved the `iCarouselTypeCoverFlow2` implementation. - Tweaked acceleration parameters for smoother scrolling behaviour. - Improved loading sequence to reduce repeated calls to dataSource methods during startup. - Added No-nib example for iPhone to demonstrate setting up the carousel in code. Version 1.5.1 - Fixed issue with item button events being blocked by gesture recogniser. - Tweaked bounce and acceleration parameters for smoother scrolling. - Made `toggle` property public (used to implement CoverFlow2 carousel style). Version 1.5 - Added a new carousel type, iCarouselTypeCoverflow2, which more closely matches the appearance of the standard Apple CoverFlow implementation. - iCarousel now always stops exactly on an item boundary when decelerating, instead of over or under-shooting and scrolling to the correct position. - Added carouselScrollSpeed delegate method and increased default scrolling speed for CoverFlow carousel types. - Animation now uses CADisplayLink on iOS for better performance. - Animation is now paused when carousel is not moving. - Reduced default deceleration rate so carousel can be 'flicked' further. - Added insert/remove carousel item support for Mac OS. Version 1.4 - Added a new dynamic loading system to load and release views as needed. The carousel can now contain hundreds of thousands of items but only display a subset of them. - Added numberOfVisibleItems property to control the number of views to be loaded concurrently. - Added visibleViews property, containing a set of all visible item views. - Removed the itemViews and placeholderViews properties, as these no longer work with the new loading system. Version 1.3.4 - Changed order of execution for when carouselDidEndScrollingAnimation is called to prevent animation glitches when making changes to carousel in the callback. - Fixed glitch where didSelectItemAtIndex method would never fire for the currently centered view. Version 1.3.3 - Added several additional delegate methods for tracking when the carousel scrolls and decelerates. - Fixed some glitches when using the scrollwheel/trackpad on a Mac. Version 1.3.2 - Fixed additional scrolling bug introduced by 1.3.1 fix. - Improved deceleration logic on non-wrapped carousels. Version 1.3.1 - Fixed scrolling bug on wrapped carousels when scrolling from item at index zero back to the last item. Version 1.3 - Added Mac OS support. Most - but not all - features from the iOS version are supported (see readme.md for details. Thanks go to Sushant Prakash for proving the concept). - Added centerItemWhenSelected property to disable the auto-centering behaviour when tapping on item views. - Added carousel:didSelectItemAtIndex: delegate method which is called when a user taps any item view in the carousel. - Changed placeholder view behaviour slightly to be more flexible and intuitive. - Bug and performance fixes to the depth sorting and positioning logic. - Extended the example project to demonstrate the use of placeholder views and the new delegate method. - Converted documentation and license files to markdown format. Version 1.2.4 - Added ability to specify scroll animation duration. - Added scrollByNumberOfItems method to programmatically scroll the carousel by a specified distance in either direction. - Fixed retain cycle that prevented carousel from being deallocated properly. Version 1.2.3 - Added contentOffset and viewpointOffset properties for adjusting layout and perspective. - Made contentView property public. - Fixed issue when inserting items into an empty carousel. - Fixed issue when scrolling more than one step in a wrapped carousel. Version 1.2.2 - Removed an iOS 4-specific API so that iCarousel will work on iOS 3.2. - Fixed crash when removing last item in a carousel or inserting items into an empty carousel. Version 1.2.1 - Fixed scrolling issue with carousel when last item is removed. - Added insert/delete buttons to example project. Version 1.2 - Smooth scrolling and acceleration, no longer based on UIScrollView. - Added decelerationRate and bounces properties. - Tap any visible item in the carousel to center it. - Fixed crash on memory warning. - Added wrap on/off selector to example. - Example project is now a universal app. Version 1.1.2 - Smoother animation when inserting items into carousel. - iCarousel no longer modifies item view alpha when adding/removing items. Version 1.1.1 - Fixed bug when inserting items into the carousel without animation. - Fixed page scrolling bug on iOS 4.2 and earlier. Version 1.1 - Added itemViews property. - Added perspective property. - Added scrollEnabled property. - Added placeholder views feature. - Fixed vanishing views bug in example project. Version 1.0 - Initial release. ================================================ FILE: Tests/Events/en.lproj/InfoPlist.strings ================================================ /* Localized versions of Info.plist keys */ ================================================ FILE: Tests/Events/en.lproj/MainWindow.xib ================================================ 1024 10D571 786 1038.29 460.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin 112 YES YES com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES YES YES IBFilesOwner IBCocoaTouchFramework IBFirstResponder IBCocoaTouchFramework IBCocoaTouchFramework iCarouselExampleViewController 1 IBCocoaTouchFramework NO 292 {320, 480} 1 MSAxIDEAA NO NO IBCocoaTouchFramework YES YES delegate 4 viewController 11 window 14 YES 0 -1 File's Owner 3 iCarouselExample App Delegate -2 10 12 YES YES -1.CustomClassName -2.CustomClassName 10.CustomClassName 10.IBEditorWindowLastContentRect 10.IBPluginDependency 12.IBEditorWindowLastContentRect 12.IBPluginDependency 3.CustomClassName 3.IBPluginDependency YES UIApplication UIResponder iCarouselExampleViewController {{234, 376}, {320, 480}} com.apple.InterfaceBuilder.IBCocoaTouchPlugin {{525, 346}, {320, 480}} com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarouselExampleAppDelegate com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES YES YES 15 YES UIWindow UIView IBUserSource iCarouselExampleAppDelegate NSObject YES YES viewController window YES iCarouselExampleViewController UIWindow YES YES viewController window YES viewController iCarouselExampleViewController window UIWindow IBProjectSource iCarouselExampleAppDelegate.h iCarouselExampleAppDelegate NSObject IBUserSource iCarouselExampleViewController UIViewController IBProjectSource iCarouselExampleViewController.h YES NSObject IBFrameworkSource Foundation.framework/Headers/NSError.h NSObject IBFrameworkSource Foundation.framework/Headers/NSFileManager.h NSObject IBFrameworkSource Foundation.framework/Headers/NSKeyValueCoding.h NSObject IBFrameworkSource Foundation.framework/Headers/NSKeyValueObserving.h NSObject IBFrameworkSource Foundation.framework/Headers/NSKeyedArchiver.h NSObject IBFrameworkSource Foundation.framework/Headers/NSObject.h NSObject IBFrameworkSource Foundation.framework/Headers/NSRunLoop.h NSObject IBFrameworkSource Foundation.framework/Headers/NSThread.h NSObject IBFrameworkSource Foundation.framework/Headers/NSURL.h NSObject IBFrameworkSource Foundation.framework/Headers/NSURLConnection.h NSObject IBFrameworkSource UIKit.framework/Headers/UIAccessibility.h NSObject IBFrameworkSource UIKit.framework/Headers/UINibLoading.h NSObject IBFrameworkSource UIKit.framework/Headers/UIResponder.h UIApplication UIResponder IBFrameworkSource UIKit.framework/Headers/UIApplication.h UIResponder NSObject UISearchBar UIView IBFrameworkSource UIKit.framework/Headers/UISearchBar.h UISearchDisplayController NSObject IBFrameworkSource UIKit.framework/Headers/UISearchDisplayController.h UIView IBFrameworkSource UIKit.framework/Headers/UITextField.h UIView UIResponder IBFrameworkSource UIKit.framework/Headers/UIView.h UIViewController IBFrameworkSource UIKit.framework/Headers/UINavigationController.h UIViewController IBFrameworkSource UIKit.framework/Headers/UIPopoverController.h UIViewController IBFrameworkSource UIKit.framework/Headers/UISplitViewController.h UIViewController IBFrameworkSource UIKit.framework/Headers/UITabBarController.h UIViewController UIResponder IBFrameworkSource UIKit.framework/Headers/UIViewController.h UIWindow UIView IBFrameworkSource UIKit.framework/Headers/UIWindow.h 0 IBCocoaTouchFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 YES iCarouselExample.xcodeproj 3 112 ================================================ FILE: Tests/Events/en.lproj/iCarouselExampleViewController.xib ================================================ 1280 11C74 1938 1138.23 567.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin 933 YES IBProxyObject IBUIView IBUIButton YES com.apple.InterfaceBuilder.IBCocoaTouchPlugin PluginDependencyRecalculationVersion YES IBFilesOwner IBCocoaTouchFramework IBFirstResponder IBCocoaTouchFramework 274 YES 274 {320, 460} 3 MSAwAA 2 IBCocoaTouchFramework 293 {{93, 27}, {133, 37}} NO IBCocoaTouchFramework 0 0 1 Enable buttons 3 MQA 1 MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA 3 MC41AA 2 15 Helvetica-Bold 15 16 {{0, 20}, {320, 460}} 3 MC4zMzMzMzMzMzMzAA NO IBCocoaTouchFramework YES view 7 carousel 9 dataSource 10 delegate 11 toggleButtons: 7 34 YES 0 YES -1 File's Owner -2 6 YES 8 YES iCarousel 33 YES YES -1.CustomClassName -1.IBPluginDependency -2.CustomClassName -2.IBPluginDependency 33.IBPluginDependency 6.IBPluginDependency 8.CustomClassName 8.IBPluginDependency YES iCarouselExampleViewController com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIResponder com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarousel com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES 34 YES iCarousel UIView YES YES dataSource delegate YES id id YES YES dataSource delegate YES dataSource id delegate id IBProjectSource ./Classes/iCarousel.h iCarouselExampleViewController UIViewController toggleButtons: UIButton toggleButtons: toggleButtons: UIButton carousel iCarousel carousel carousel iCarousel IBProjectSource ./Classes/iCarouselExampleViewController.h 0 IBCocoaTouchFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 YES 3 933 ================================================ FILE: Tests/Events/iCarouselExampleAppDelegate.h ================================================ // // iCarouselExampleAppDelegate.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import @class iCarouselExampleViewController; @interface iCarouselExampleAppDelegate : NSObject @property (nonatomic, strong) IBOutlet UIWindow *window; @property (nonatomic, strong) IBOutlet iCarouselExampleViewController *viewController; @end ================================================ FILE: Tests/Events/iCarouselExampleAppDelegate.m ================================================ // // iCarouselExampleAppDelegate.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleAppDelegate.h" #import "iCarouselExampleViewController.h" @implementation iCarouselExampleAppDelegate @synthesize window; @synthesize viewController; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [window addSubview:viewController.view]; [window makeKeyAndVisible]; return YES; } @end ================================================ FILE: Tests/Events/iCarouselExampleViewController.h ================================================ // // iCarouselExampleViewController.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import #import "iCarousel.h" @interface iCarouselExampleViewController : UIViewController @property (nonatomic, strong) IBOutlet iCarousel *carousel; - (IBAction)toggleButtons:(UIButton *)button; @end ================================================ FILE: Tests/Events/iCarouselExampleViewController.m ================================================ // // iCarouselExampleViewController.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleViewController.h" @interface iCarouselExampleViewController () @property (nonatomic, assign) BOOL useButtons; @end @implementation iCarouselExampleViewController @synthesize carousel; @synthesize useButtons; - (void)toggleButtons:(UIButton *)button { useButtons = !useButtons; [button setTitle:useButtons? @"Disable buttons": @"Enable buttons" forState:UIControlStateNormal]; [carousel reloadData]; } - (void)dealloc { carousel.delegate = nil; carousel.dataSource = nil; } #pragma mark - #pragma mark View lifecycle - (void)viewDidLoad { [super viewDidLoad]; //configure carousel carousel.type = iCarouselTypeCoverFlow2; } - (void)viewDidUnload { [super viewDidUnload]; self.carousel = nil; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } #pragma mark - #pragma mark iCarousel methods - (NSInteger)numberOfItemsInCarousel:(iCarousel *)carousel { return 1000; } - (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view { if (useButtons) { //create a numbered button UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; button.frame = CGRectMake(0, 0, 200.0f, 200.0f); [button setTitle:[NSString stringWithFormat:@"%i", index] forState:UIControlStateNormal]; [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; button.titleLabel.font = [button.titleLabel.font fontWithSize:50]; [button addTarget:self action:@selector(buttonTapped:) forControlEvents:UIControlEventTouchUpInside]; return button; } else { //create a numbered view view = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 200.0f, 200.0f)]; view.backgroundColor = [UIColor lightGrayColor]; UILabel *label = [[UILabel alloc] initWithFrame:view.bounds]; label.text = [NSString stringWithFormat:@"%i", index]; label.backgroundColor = [UIColor clearColor]; label.textAlignment = UITextAlignmentCenter; label.font = [label.font fontWithSize:50]; [view addSubview:label]; return view; } } - (void)carouselWillBeginDragging:(iCarousel *)carousel { NSLog(@"Carousel will begin dragging"); } - (void)carouselDidEndDragging:(iCarousel *)carousel willDecelerate:(BOOL)decelerate { NSLog(@"Carousel did end dragging and %@ decelerate", decelerate? @"will": @"won't"); } - (void)carouselWillBeginDecelerating:(iCarousel *)carousel { NSLog(@"Carousel will begin decelerating"); } - (void)carouselDidEndDecelerating:(iCarousel *)carousel { NSLog(@"Carousel did end decelerating"); } - (void)carouselWillBeginScrollingAnimation:(iCarousel *)carousel { NSLog(@"Carousel will begin scrolling"); } - (void)carouselDidEndScrollingAnimation:(iCarousel *)carousel { NSLog(@"Carousel did end scrolling"); } - (BOOL)carousel:(iCarousel *)_carousel shouldSelectItemAtIndex:(NSInteger)index { if (index == carousel.currentItemIndex) { NSLog(@"Should select current item"); } else { NSLog(@"Should select item number %i", index); } return YES; } - (void)carousel:(iCarousel *)_carousel didSelectItemAtIndex:(NSInteger)index { if (index == carousel.currentItemIndex) { //note, this will only ever happen if useButtons == NO //otherwise the button intercepts the tap event NSLog(@"Did select current item"); } else { NSLog(@"Did select item number %i", index); } } #pragma mark - #pragma mark Button tap event - (void)buttonTapped:(UIButton *)sender { [[[UIAlertView alloc] initWithTitle:@"Button Tapped" message:[NSString stringWithFormat:@"You tapped button number %i", [carousel indexOfItemView:sender]] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] show]; } @end ================================================ FILE: Tests/Events/iCarouselTest-Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleDisplayName ${PRODUCT_NAME} CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIconFile CFBundleIdentifier com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier} CFBundleInfoDictionaryVersion 6.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1.0 LSRequiresIPhoneOS NSMainNibFile MainWindow UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIStatusBarHidden ================================================ FILE: Tests/Events/iCarouselTest-Prefix.pch ================================================ // // Prefix header for all source files of the 'iCarouselExample' target in the 'iCarouselExample' project // #import #ifndef __IPHONE_3_0 #warning "This project uses features only available in iPhone SDK 3.0 and later." #endif #ifdef __OBJC__ #import #import #endif ================================================ FILE: Tests/Events/iCarouselTest.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 01308D9313491C3500453707 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9213491C3500453707 /* UIKit.framework */; }; 01308D9513491C3500453707 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9413491C3500453707 /* Foundation.framework */; }; 01308D9713491C3500453707 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9613491C3500453707 /* CoreGraphics.framework */; }; 01308DC013491F7200453707 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308DBF13491F7200453707 /* QuartzCore.framework */; }; 0148358813A36C2000E687AC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358313A36C2000E687AC /* main.m */; }; 0148359313A36C3700E687AC /* iCarouselExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */; }; 0148359413A36C3700E687AC /* iCarouselExampleAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */; }; 0148359513A36C3700E687AC /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0148358F13A36C3700E687AC /* MainWindow.xib */; }; 0148359613A36C3700E687AC /* iCarouselExampleViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */; }; 01C5BF7E17A4404700B7B0BC /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 01C5BF7D17A4404700B7B0BC /* Default-568h@2x.png */; }; B2E5E749146155E300EADB7A /* iCarousel.m in Sources */ = {isa = PBXBuildFile; fileRef = B2E5E748146155E300EADB7A /* iCarousel.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 01308D9213491C3500453707 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 01308D9413491C3500453707 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 01308D9613491C3500453707 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 01308DBF13491F7200453707 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 0148358313A36C2000E687AC /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = SOURCE_ROOT; }; 0148358413A36C2000E687AC /* iCarouselTest-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "iCarouselTest-Prefix.pch"; sourceTree = SOURCE_ROOT; }; 0148358513A36C2000E687AC /* iCarouselTest-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "iCarouselTest-Info.plist"; sourceTree = SOURCE_ROOT; }; 0148358713A36C2000E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = SOURCE_ROOT; }; 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleViewController.m; sourceTree = SOURCE_ROOT; }; 0148358C13A36C3700E687AC /* iCarouselExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleViewController.h; sourceTree = SOURCE_ROOT; }; 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleAppDelegate.m; sourceTree = SOURCE_ROOT; }; 0148358E13A36C3700E687AC /* iCarouselExampleAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleAppDelegate.h; sourceTree = SOURCE_ROOT; }; 0148359013A36C3700E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainWindow.xib; sourceTree = SOURCE_ROOT; }; 0148359213A36C3700E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/iCarouselExampleViewController.xib; sourceTree = SOURCE_ROOT; }; 018BBCB413A375AF005CA505 /* iCarouselTest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iCarouselTest.app; sourceTree = BUILT_PRODUCTS_DIR; }; 01C5BF7D17A4404700B7B0BC /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = SOURCE_ROOT; }; B2E5E747146155E300EADB7A /* iCarousel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarousel.h; sourceTree = ""; }; B2E5E748146155E300EADB7A /* iCarousel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarousel.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 01308D8B13491C3500453707 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 01308DC013491F7200453707 /* QuartzCore.framework in Frameworks */, 01308D9313491C3500453707 /* UIKit.framework in Frameworks */, 01308D9513491C3500453707 /* Foundation.framework in Frameworks */, 01308D9713491C3500453707 /* CoreGraphics.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 01308D8313491C3500453707 = { isa = PBXGroup; children = ( B2E5E746146155E300EADB7A /* iCarousel */, 01308D9813491C3500453707 /* iCarouselTest */, 01308D9113491C3500453707 /* Frameworks */, 01308D8F13491C3500453707 /* Products */, ); sourceTree = ""; }; 01308D8F13491C3500453707 /* Products */ = { isa = PBXGroup; children = ( 018BBCB413A375AF005CA505 /* iCarouselTest.app */, ); name = Products; sourceTree = ""; }; 01308D9113491C3500453707 /* Frameworks */ = { isa = PBXGroup; children = ( 01308DBF13491F7200453707 /* QuartzCore.framework */, 01308D9213491C3500453707 /* UIKit.framework */, 01308D9413491C3500453707 /* Foundation.framework */, 01308D9613491C3500453707 /* CoreGraphics.framework */, ); name = Frameworks; sourceTree = ""; }; 01308D9813491C3500453707 /* iCarouselTest */ = { isa = PBXGroup; children = ( 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */, 0148358C13A36C3700E687AC /* iCarouselExampleViewController.h */, 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */, 0148358E13A36C3700E687AC /* iCarouselExampleAppDelegate.h */, 0148358F13A36C3700E687AC /* MainWindow.xib */, 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */, 01308D9913491C3500453707 /* Supporting Files */, ); name = iCarouselTest; path = iCarouselExample; sourceTree = ""; }; 01308D9913491C3500453707 /* Supporting Files */ = { isa = PBXGroup; children = ( 0148358313A36C2000E687AC /* main.m */, 01C5BF7D17A4404700B7B0BC /* Default-568h@2x.png */, 0148358413A36C2000E687AC /* iCarouselTest-Prefix.pch */, 0148358513A36C2000E687AC /* iCarouselTest-Info.plist */, 0148358613A36C2000E687AC /* InfoPlist.strings */, ); name = "Supporting Files"; sourceTree = ""; }; B2E5E746146155E300EADB7A /* iCarousel */ = { isa = PBXGroup; children = ( B2E5E747146155E300EADB7A /* iCarousel.h */, B2E5E748146155E300EADB7A /* iCarousel.m */, ); name = iCarousel; path = ../../iCarousel; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 01308D8D13491C3500453707 /* iCarouselTest */ = { isa = PBXNativeTarget; buildConfigurationList = 01308DAF13491C3500453707 /* Build configuration list for PBXNativeTarget "iCarouselTest" */; buildPhases = ( 01308D8A13491C3500453707 /* Sources */, 01308D8B13491C3500453707 /* Frameworks */, 01308D8C13491C3500453707 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = iCarouselTest; productName = iCarouselExample; productReference = 018BBCB413A375AF005CA505 /* iCarouselTest.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 01308D8513491C3500453707 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0500; }; buildConfigurationList = 01308D8813491C3500453707 /* Build configuration list for PBXProject "iCarouselTest" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); mainGroup = 01308D8313491C3500453707; productRefGroup = 01308D8F13491C3500453707 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 01308D8D13491C3500453707 /* iCarouselTest */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 01308D8C13491C3500453707 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 0148359513A36C3700E687AC /* MainWindow.xib in Resources */, 0148359613A36C3700E687AC /* iCarouselExampleViewController.xib in Resources */, 01C5BF7E17A4404700B7B0BC /* Default-568h@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 01308D8A13491C3500453707 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 0148358813A36C2000E687AC /* main.m in Sources */, 0148359313A36C3700E687AC /* iCarouselExampleViewController.m in Sources */, 0148359413A36C3700E687AC /* iCarouselExampleAppDelegate.m in Sources */, B2E5E749146155E300EADB7A /* iCarousel.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 0148358613A36C2000E687AC /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( 0148358713A36C2000E687AC /* en */, ); name = InfoPlist.strings; sourceTree = ""; }; 0148358F13A36C3700E687AC /* MainWindow.xib */ = { isa = PBXVariantGroup; children = ( 0148359013A36C3700E687AC /* en */, ); name = MainWindow.xib; sourceTree = ""; }; 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */ = { isa = PBXVariantGroup; children = ( 0148359213A36C3700E687AC /* en */, ); name = iCarouselExampleViewController.xib; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 01308DAD13491C3500453707 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = DEBUG; GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 4.2; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; }; name = Debug; }; 01308DAE13491C3500453707 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 4.2; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; SDKROOT = iphoneos; }; name = Release; }; 01308DB013491C3500453707 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselTest-Prefix.pch"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = "iCarouselTest-Info.plist"; PRODUCT_NAME = iCarouselTest; TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = app; }; name = Debug; }; 01308DB113491C3500453707 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselTest-Prefix.pch"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = "iCarouselTest-Info.plist"; PRODUCT_NAME = iCarouselTest; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; WRAPPER_EXTENSION = app; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 01308D8813491C3500453707 /* Build configuration list for PBXProject "iCarouselTest" */ = { isa = XCConfigurationList; buildConfigurations = ( 01308DAD13491C3500453707 /* Debug */, 01308DAE13491C3500453707 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 01308DAF13491C3500453707 /* Build configuration list for PBXNativeTarget "iCarouselTest" */ = { isa = XCConfigurationList; buildConfigurations = ( 01308DB013491C3500453707 /* Debug */, 01308DB113491C3500453707 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 01308D8513491C3500453707 /* Project object */; } ================================================ FILE: Tests/Events/iCarouselTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: Tests/Events/main.m ================================================ // // main.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import int main(int argc, char *argv[]) { @autoreleasepool { int retVal = UIApplicationMain(argc, argv, nil, nil); return retVal; } } ================================================ FILE: Tests/Scrolling/en.lproj/InfoPlist.strings ================================================ /* Localized versions of Info.plist keys */ ================================================ FILE: Tests/Scrolling/en.lproj/MainWindow.xib ================================================ 1024 10D571 786 1038.29 460.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin 112 YES YES com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES YES YES IBFilesOwner IBCocoaTouchFramework IBFirstResponder IBCocoaTouchFramework IBCocoaTouchFramework iCarouselExampleViewController 1 IBCocoaTouchFramework NO 292 {320, 480} 1 MSAxIDEAA NO NO IBCocoaTouchFramework YES YES delegate 4 viewController 11 window 14 YES 0 -1 File's Owner 3 iCarouselExample App Delegate -2 10 12 YES YES -1.CustomClassName -2.CustomClassName 10.CustomClassName 10.IBEditorWindowLastContentRect 10.IBPluginDependency 12.IBEditorWindowLastContentRect 12.IBPluginDependency 3.CustomClassName 3.IBPluginDependency YES UIApplication UIResponder iCarouselExampleViewController {{234, 376}, {320, 480}} com.apple.InterfaceBuilder.IBCocoaTouchPlugin {{525, 346}, {320, 480}} com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarouselExampleAppDelegate com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES YES YES 15 YES UIWindow UIView IBUserSource iCarouselExampleAppDelegate NSObject YES YES viewController window YES iCarouselExampleViewController UIWindow YES YES viewController window YES viewController iCarouselExampleViewController window UIWindow IBProjectSource iCarouselExampleAppDelegate.h iCarouselExampleAppDelegate NSObject IBUserSource iCarouselExampleViewController UIViewController IBProjectSource iCarouselExampleViewController.h YES NSObject IBFrameworkSource Foundation.framework/Headers/NSError.h NSObject IBFrameworkSource Foundation.framework/Headers/NSFileManager.h NSObject IBFrameworkSource Foundation.framework/Headers/NSKeyValueCoding.h NSObject IBFrameworkSource Foundation.framework/Headers/NSKeyValueObserving.h NSObject IBFrameworkSource Foundation.framework/Headers/NSKeyedArchiver.h NSObject IBFrameworkSource Foundation.framework/Headers/NSObject.h NSObject IBFrameworkSource Foundation.framework/Headers/NSRunLoop.h NSObject IBFrameworkSource Foundation.framework/Headers/NSThread.h NSObject IBFrameworkSource Foundation.framework/Headers/NSURL.h NSObject IBFrameworkSource Foundation.framework/Headers/NSURLConnection.h NSObject IBFrameworkSource UIKit.framework/Headers/UIAccessibility.h NSObject IBFrameworkSource UIKit.framework/Headers/UINibLoading.h NSObject IBFrameworkSource UIKit.framework/Headers/UIResponder.h UIApplication UIResponder IBFrameworkSource UIKit.framework/Headers/UIApplication.h UIResponder NSObject UISearchBar UIView IBFrameworkSource UIKit.framework/Headers/UISearchBar.h UISearchDisplayController NSObject IBFrameworkSource UIKit.framework/Headers/UISearchDisplayController.h UIView IBFrameworkSource UIKit.framework/Headers/UITextField.h UIView UIResponder IBFrameworkSource UIKit.framework/Headers/UIView.h UIViewController IBFrameworkSource UIKit.framework/Headers/UINavigationController.h UIViewController IBFrameworkSource UIKit.framework/Headers/UIPopoverController.h UIViewController IBFrameworkSource UIKit.framework/Headers/UISplitViewController.h UIViewController IBFrameworkSource UIKit.framework/Headers/UITabBarController.h UIViewController UIResponder IBFrameworkSource UIKit.framework/Headers/UIViewController.h UIWindow UIView IBFrameworkSource UIKit.framework/Headers/UIWindow.h 0 IBCocoaTouchFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 YES iCarouselExample.xcodeproj 3 112 ================================================ FILE: Tests/Scrolling/en.lproj/iCarouselExampleViewController.xib ================================================ 1552 13A603 3084 1265 695.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin 2083 YES IBProxyObject IBUIButton IBUIView YES com.apple.InterfaceBuilder.IBCocoaTouchPlugin PluginDependencyRecalculationVersion YES IBFilesOwner IBCocoaTouchFramework IBFirstResponder IBCocoaTouchFramework 274 YES 274 YES {320, 460} 3 MSAwAA 2 IBCocoaTouchFramework 293 {{85, 20}, {150, 37}} NO IBCocoaTouchFramework 0 0 1 Reload and scroll 3 MQA 1 MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA 3 MC41AA 2 15 Helvetica-Bold 15 16 269 {{110, 404}, {100, 37}} _NS:9 NO IBCocoaTouchFramework 0 0 1 Stop 1 MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA {{0, 20}, {320, 460}} 3 MC4zMzMzMzMzMzMzAA NO IBCocoaTouchFramework YES view 7 carousel 9 dataSource 10 delegate 11 reloadAndScroll 7 35 stop 7 37 YES 0 YES -1 File's Owner -2 6 YES 8 YES iCarousel 33 36 YES YES -1.CustomClassName -1.IBPluginDependency -2.CustomClassName -2.IBPluginDependency 33.IBPluginDependency 36.IBPluginDependency 6.IBPluginDependency 8.CustomClassName 8.IBPluginDependency YES iCarouselExampleViewController com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIResponder com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin iCarousel com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES YES 37 YES iCarousel UIView YES YES dataSource delegate YES id id YES YES dataSource delegate YES dataSource id delegate id IBProjectSource ./Classes/iCarousel.h iCarouselExampleViewController UIViewController carousel iCarousel carousel carousel iCarousel IBProjectSource ./Classes/iCarouselExampleViewController.h 0 IBCocoaTouchFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 YES 3 2083 ================================================ FILE: Tests/Scrolling/iCarouselExampleAppDelegate.h ================================================ // // iCarouselExampleAppDelegate.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import @class iCarouselExampleViewController; @interface iCarouselExampleAppDelegate : NSObject @property (nonatomic, strong) IBOutlet UIWindow *window; @property (nonatomic, strong) IBOutlet iCarouselExampleViewController *viewController; @end ================================================ FILE: Tests/Scrolling/iCarouselExampleAppDelegate.m ================================================ // // iCarouselExampleAppDelegate.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleAppDelegate.h" #import "iCarouselExampleViewController.h" @implementation iCarouselExampleAppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [self.window addSubview:self.viewController.view]; [self.window makeKeyAndVisible]; return YES; } @end ================================================ FILE: Tests/Scrolling/iCarouselExampleViewController.h ================================================ // // iCarouselExampleViewController.h // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import #import "iCarousel.h" @interface iCarouselExampleViewController : UIViewController @property (nonatomic, strong) IBOutlet iCarousel *carousel; @end ================================================ FILE: Tests/Scrolling/iCarouselExampleViewController.m ================================================ // // iCarouselExampleViewController.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import "iCarouselExampleViewController.h" @implementation iCarouselExampleViewController - (IBAction)reloadAndScroll; { [self.carousel reloadData]; self.carousel.scrollToItemBoundary = NO; [self.carousel scrollByOffset:4.5 duration:0.0]; } - (IBAction)stop { self.carousel.scrollOffset = self.carousel.scrollOffset; } - (void)dealloc { self.carousel.delegate = nil; self.carousel.dataSource = nil; } #pragma mark - #pragma mark View lifecycle - (void)viewDidLoad { [super viewDidLoad]; //configure carousel self.carousel.type = iCarouselTypeCoverFlow; //scroll to fixed offset [self.carousel scrollToItemAtIndex:5 animated:NO]; } - (void)viewDidUnload { [super viewDidUnload]; self.carousel = nil; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } #pragma mark - #pragma mark iCarousel methods - (NSInteger)numberOfItemsInCarousel:(iCarousel *)carousel { return 1000; } - (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view { //create a numbered view view = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 200.0f, 200.0f)]; view.backgroundColor = [UIColor lightGrayColor]; UILabel *label = [[UILabel alloc] initWithFrame:view.bounds]; label.text = [NSString stringWithFormat:@"%i", index]; label.backgroundColor = [UIColor clearColor]; label.textAlignment = UITextAlignmentCenter; label.font = [label.font fontWithSize:50]; [view addSubview:label]; return view; } - (CGFloat)carousel:(iCarousel *)carousel valueForOption:(iCarouselOption)option withDefault:(CGFloat)value { switch (option) { case iCarouselOptionWrap: { return YES; } default: { return value; } } } - (void)carouselWillBeginDragging:(iCarousel *)carousel { NSLog(@"Carousel will begin dragging"); } - (void)carouselDidEndDragging:(iCarousel *)carousel willDecelerate:(BOOL)decelerate { NSLog(@"Carousel did end dragging and %@ decelerate", decelerate? @"will": @"won't"); } - (void)carouselWillBeginDecelerating:(iCarousel *)carousel { NSLog(@"Carousel will begin decelerating"); } - (void)carouselDidEndDecelerating:(iCarousel *)carousel { NSLog(@"Carousel did end decelerating"); } - (void)carouselWillBeginScrollingAnimation:(iCarousel *)carousel { NSLog(@"Carousel will begin scrolling"); } - (void)carouselDidEndScrollingAnimation:(iCarousel *)carousel { NSLog(@"Carousel did end scrolling"); } @end ================================================ FILE: Tests/Scrolling/iCarouselTest-Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleDisplayName ${PRODUCT_NAME} CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIconFile CFBundleIdentifier com.charcoaldesign.${PRODUCT_NAME:rfc1034identifier} CFBundleInfoDictionaryVersion 6.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1.0 LSRequiresIPhoneOS NSMainNibFile MainWindow UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIStatusBarHidden ================================================ FILE: Tests/Scrolling/iCarouselTest-Prefix.pch ================================================ // // Prefix header for all source files of the 'iCarouselExample' target in the 'iCarouselExample' project // #import #ifndef __IPHONE_3_0 #warning "This project uses features only available in iPhone SDK 3.0 and later." #endif #ifdef __OBJC__ #import #import #endif ================================================ FILE: Tests/Scrolling/iCarouselTest.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 01308D9313491C3500453707 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9213491C3500453707 /* UIKit.framework */; }; 01308D9513491C3500453707 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9413491C3500453707 /* Foundation.framework */; }; 01308D9713491C3500453707 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308D9613491C3500453707 /* CoreGraphics.framework */; }; 01308DC013491F7200453707 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01308DBF13491F7200453707 /* QuartzCore.framework */; }; 0148358813A36C2000E687AC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358313A36C2000E687AC /* main.m */; }; 0148359313A36C3700E687AC /* iCarouselExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */; }; 0148359413A36C3700E687AC /* iCarouselExampleAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */; }; 0148359513A36C3700E687AC /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0148358F13A36C3700E687AC /* MainWindow.xib */; }; 0148359613A36C3700E687AC /* iCarouselExampleViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */; }; 01C5BF8017A4408E00B7B0BC /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 01C5BF7F17A4408E00B7B0BC /* Default-568h@2x.png */; }; B2E5E749146155E300EADB7A /* iCarousel.m in Sources */ = {isa = PBXBuildFile; fileRef = B2E5E748146155E300EADB7A /* iCarousel.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 01308D9213491C3500453707 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 01308D9413491C3500453707 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 01308D9613491C3500453707 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 01308DBF13491F7200453707 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 0148358313A36C2000E687AC /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = SOURCE_ROOT; }; 0148358413A36C2000E687AC /* iCarouselTest-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "iCarouselTest-Prefix.pch"; sourceTree = SOURCE_ROOT; }; 0148358513A36C2000E687AC /* iCarouselTest-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "iCarouselTest-Info.plist"; sourceTree = SOURCE_ROOT; }; 0148358713A36C2000E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = SOURCE_ROOT; }; 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleViewController.m; sourceTree = SOURCE_ROOT; }; 0148358C13A36C3700E687AC /* iCarouselExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleViewController.h; sourceTree = SOURCE_ROOT; }; 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarouselExampleAppDelegate.m; sourceTree = SOURCE_ROOT; }; 0148358E13A36C3700E687AC /* iCarouselExampleAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarouselExampleAppDelegate.h; sourceTree = SOURCE_ROOT; }; 0148359013A36C3700E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainWindow.xib; sourceTree = SOURCE_ROOT; }; 0148359213A36C3700E687AC /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/iCarouselExampleViewController.xib; sourceTree = SOURCE_ROOT; }; 018BBCB413A375AF005CA505 /* iCarouselTest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iCarouselTest.app; sourceTree = BUILT_PRODUCTS_DIR; }; 01C5BF7F17A4408E00B7B0BC /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = SOURCE_ROOT; }; B2E5E747146155E300EADB7A /* iCarousel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarousel.h; sourceTree = ""; }; B2E5E748146155E300EADB7A /* iCarousel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarousel.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 01308D8B13491C3500453707 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 01308DC013491F7200453707 /* QuartzCore.framework in Frameworks */, 01308D9313491C3500453707 /* UIKit.framework in Frameworks */, 01308D9513491C3500453707 /* Foundation.framework in Frameworks */, 01308D9713491C3500453707 /* CoreGraphics.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 01308D8313491C3500453707 = { isa = PBXGroup; children = ( B2E5E746146155E300EADB7A /* iCarousel */, 01308D9813491C3500453707 /* iCarouselTest */, 01308D9113491C3500453707 /* Frameworks */, 01308D8F13491C3500453707 /* Products */, ); sourceTree = ""; }; 01308D8F13491C3500453707 /* Products */ = { isa = PBXGroup; children = ( 018BBCB413A375AF005CA505 /* iCarouselTest.app */, ); name = Products; sourceTree = ""; }; 01308D9113491C3500453707 /* Frameworks */ = { isa = PBXGroup; children = ( 01308DBF13491F7200453707 /* QuartzCore.framework */, 01308D9213491C3500453707 /* UIKit.framework */, 01308D9413491C3500453707 /* Foundation.framework */, 01308D9613491C3500453707 /* CoreGraphics.framework */, ); name = Frameworks; sourceTree = ""; }; 01308D9813491C3500453707 /* iCarouselTest */ = { isa = PBXGroup; children = ( 0148358B13A36C3700E687AC /* iCarouselExampleViewController.m */, 0148358C13A36C3700E687AC /* iCarouselExampleViewController.h */, 0148358D13A36C3700E687AC /* iCarouselExampleAppDelegate.m */, 0148358E13A36C3700E687AC /* iCarouselExampleAppDelegate.h */, 0148358F13A36C3700E687AC /* MainWindow.xib */, 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */, 01308D9913491C3500453707 /* Supporting Files */, ); name = iCarouselTest; path = iCarouselExample; sourceTree = ""; }; 01308D9913491C3500453707 /* Supporting Files */ = { isa = PBXGroup; children = ( 01C5BF7F17A4408E00B7B0BC /* Default-568h@2x.png */, 0148358313A36C2000E687AC /* main.m */, 0148358413A36C2000E687AC /* iCarouselTest-Prefix.pch */, 0148358513A36C2000E687AC /* iCarouselTest-Info.plist */, 0148358613A36C2000E687AC /* InfoPlist.strings */, ); name = "Supporting Files"; sourceTree = ""; }; B2E5E746146155E300EADB7A /* iCarousel */ = { isa = PBXGroup; children = ( B2E5E747146155E300EADB7A /* iCarousel.h */, B2E5E748146155E300EADB7A /* iCarousel.m */, ); name = iCarousel; path = ../../iCarousel; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 01308D8D13491C3500453707 /* iCarouselTest */ = { isa = PBXNativeTarget; buildConfigurationList = 01308DAF13491C3500453707 /* Build configuration list for PBXNativeTarget "iCarouselTest" */; buildPhases = ( 01308D8A13491C3500453707 /* Sources */, 01308D8B13491C3500453707 /* Frameworks */, 01308D8C13491C3500453707 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = iCarouselTest; productName = iCarouselExample; productReference = 018BBCB413A375AF005CA505 /* iCarouselTest.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 01308D8513491C3500453707 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0600; }; buildConfigurationList = 01308D8813491C3500453707 /* Build configuration list for PBXProject "iCarouselTest" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); mainGroup = 01308D8313491C3500453707; productRefGroup = 01308D8F13491C3500453707 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 01308D8D13491C3500453707 /* iCarouselTest */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 01308D8C13491C3500453707 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 0148359513A36C3700E687AC /* MainWindow.xib in Resources */, 0148359613A36C3700E687AC /* iCarouselExampleViewController.xib in Resources */, 01C5BF8017A4408E00B7B0BC /* Default-568h@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 01308D8A13491C3500453707 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 0148358813A36C2000E687AC /* main.m in Sources */, 0148359313A36C3700E687AC /* iCarouselExampleViewController.m in Sources */, 0148359413A36C3700E687AC /* iCarouselExampleAppDelegate.m in Sources */, B2E5E749146155E300EADB7A /* iCarousel.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 0148358613A36C2000E687AC /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( 0148358713A36C2000E687AC /* en */, ); name = InfoPlist.strings; sourceTree = ""; }; 0148358F13A36C3700E687AC /* MainWindow.xib */ = { isa = PBXVariantGroup; children = ( 0148359013A36C3700E687AC /* en */, ); name = MainWindow.xib; sourceTree = ""; }; 0148359113A36C3700E687AC /* iCarouselExampleViewController.xib */ = { isa = PBXVariantGroup; children = ( 0148359213A36C3700E687AC /* en */, ); name = iCarouselExampleViewController.xib; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 01308DAD13491C3500453707 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = DEBUG; GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 4.2; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; }; name = Debug; }; 01308DAE13491C3500453707 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 4.2; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; SDKROOT = iphoneos; }; name = Release; }; 01308DB013491C3500453707 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselTest-Prefix.pch"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = "iCarouselTest-Info.plist"; PRODUCT_NAME = iCarouselTest; TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = app; }; name = Debug; }; 01308DB113491C3500453707 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "iCarouselTest-Prefix.pch"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = "iCarouselTest-Info.plist"; PRODUCT_NAME = iCarouselTest; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; WRAPPER_EXTENSION = app; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 01308D8813491C3500453707 /* Build configuration list for PBXProject "iCarouselTest" */ = { isa = XCConfigurationList; buildConfigurations = ( 01308DAD13491C3500453707 /* Debug */, 01308DAE13491C3500453707 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 01308DAF13491C3500453707 /* Build configuration list for PBXNativeTarget "iCarouselTest" */ = { isa = XCConfigurationList; buildConfigurations = ( 01308DB013491C3500453707 /* Debug */, 01308DB113491C3500453707 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 01308D8513491C3500453707 /* Project object */; } ================================================ FILE: Tests/Scrolling/iCarouselTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: Tests/Scrolling/main.m ================================================ // // main.m // iCarouselExample // // Created by Nick Lockwood on 03/04/2011. // Copyright 2011 Charcoal Design. All rights reserved. // #import int main(int argc, char *argv[]) { @autoreleasepool { int retVal = UIApplicationMain(argc, argv, nil, nil); return retVal; } } ================================================ FILE: iCarousel/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType FMWK CFBundleShortVersionString 1.8.3 CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass ================================================ FILE: iCarousel/iCarousel.h ================================================ // // iCarousel.h // // Version 1.8.3 // // Created by Nick Lockwood on 01/04/2011. // Copyright 2011 Charcoal Design // // Distributed under the permissive zlib License // Get the latest version from here: // // https://github.com/nicklockwood/iCarousel // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunknown-pragmas" #pragma clang diagnostic ignored "-Wreserved-id-macro" #pragma clang diagnostic ignored "-Wobjc-missing-property-synthesis" #import #undef weak_delegate #undef __weak_delegate #if __has_feature(objc_arc) && __has_feature(objc_arc_weak) && \ (!(defined __MAC_OS_X_VERSION_MIN_REQUIRED) || \ __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_8) #define weak_delegate weak #else #define weak_delegate unsafe_unretained #endif #import #if defined USING_CHAMELEON || defined __IPHONE_OS_VERSION_MAX_ALLOWED #define ICAROUSEL_IOS #else #define ICAROUSEL_MACOS #endif #ifdef ICAROUSEL_IOS #import #else #import typedef NSView UIView; #endif typedef NS_ENUM(NSInteger, iCarouselType) { iCarouselTypeLinear = 0, iCarouselTypeRotary, iCarouselTypeInvertedRotary, iCarouselTypeCylinder, iCarouselTypeInvertedCylinder, iCarouselTypeWheel, iCarouselTypeInvertedWheel, iCarouselTypeCoverFlow, iCarouselTypeCoverFlow2, iCarouselTypeTimeMachine, iCarouselTypeInvertedTimeMachine, iCarouselTypeCustom }; typedef NS_ENUM(NSInteger, iCarouselOption) { iCarouselOptionWrap = 0, iCarouselOptionShowBackfaces, iCarouselOptionOffsetMultiplier, iCarouselOptionVisibleItems, iCarouselOptionCount, iCarouselOptionArc, iCarouselOptionAngle, iCarouselOptionRadius, iCarouselOptionTilt, iCarouselOptionSpacing, iCarouselOptionFadeMin, iCarouselOptionFadeMax, iCarouselOptionFadeRange, iCarouselOptionFadeMinAlpha }; NS_ASSUME_NONNULL_BEGIN @protocol iCarouselDataSource, iCarouselDelegate; @interface iCarousel : UIView @property (nonatomic, weak_delegate) IBOutlet __nullable id dataSource; @property (nonatomic, weak_delegate) IBOutlet __nullable id delegate; @property (nonatomic, assign) iCarouselType type; @property (nonatomic, assign) CGFloat perspective; @property (nonatomic, assign) CGFloat decelerationRate; @property (nonatomic, assign) CGFloat scrollSpeed; @property (nonatomic, assign) CGFloat bounceDistance; @property (nonatomic, assign, getter = isScrollEnabled) BOOL scrollEnabled; @property (nonatomic, assign, getter = isPagingEnabled) BOOL pagingEnabled; @property (nonatomic, assign, getter = isVertical) BOOL vertical; @property (nonatomic, readonly, getter = isWrapEnabled) BOOL wrapEnabled; @property (nonatomic, assign) BOOL bounces; @property (nonatomic, assign) CGFloat scrollOffset; @property (nonatomic, readonly) CGFloat offsetMultiplier; @property (nonatomic, assign) CGSize contentOffset; @property (nonatomic, assign) CGSize viewpointOffset; @property (nonatomic, readonly) NSInteger numberOfItems; @property (nonatomic, readonly) NSInteger numberOfPlaceholders; @property (nonatomic, assign) NSInteger currentItemIndex; @property (nonatomic, strong, readonly) UIView * __nullable currentItemView; @property (nonatomic, strong, readonly) NSArray *indexesForVisibleItems; @property (nonatomic, readonly) NSInteger numberOfVisibleItems; @property (nonatomic, strong, readonly) NSArray *visibleItemViews; @property (nonatomic, readonly) CGFloat itemWidth; @property (nonatomic, strong, readonly) UIView *contentView; @property (nonatomic, readonly) CGFloat toggle; @property (nonatomic, assign) CGFloat autoscroll; @property (nonatomic, assign) BOOL stopAtItemBoundary; @property (nonatomic, assign) BOOL scrollToItemBoundary; @property (nonatomic, assign) BOOL ignorePerpendicularSwipes; @property (nonatomic, assign) BOOL centerItemWhenSelected; @property (nonatomic, readonly, getter = isDragging) BOOL dragging; @property (nonatomic, readonly, getter = isDecelerating) BOOL decelerating; @property (nonatomic, readonly, getter = isScrolling) BOOL scrolling; - (void)scrollByOffset:(CGFloat)offset duration:(NSTimeInterval)duration; - (void)scrollToOffset:(CGFloat)offset duration:(NSTimeInterval)duration; - (void)scrollByNumberOfItems:(NSInteger)itemCount duration:(NSTimeInterval)duration; - (void)scrollToItemAtIndex:(NSInteger)index duration:(NSTimeInterval)duration; - (void)scrollToItemAtIndex:(NSInteger)index animated:(BOOL)animated; - (nullable UIView *)itemViewAtIndex:(NSInteger)index; - (NSInteger)indexOfItemView:(UIView *)view; - (NSInteger)indexOfItemViewOrSubview:(UIView *)view; - (CGFloat)offsetForItemAtIndex:(NSInteger)index; - (nullable UIView *)itemViewAtPoint:(CGPoint)point; - (void)removeItemAtIndex:(NSInteger)index animated:(BOOL)animated; - (void)insertItemAtIndex:(NSInteger)index animated:(BOOL)animated; - (void)reloadItemAtIndex:(NSInteger)index animated:(BOOL)animated; - (void)reloadData; @end @protocol iCarouselDataSource - (NSInteger)numberOfItemsInCarousel:(iCarousel *)carousel; - (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(nullable UIView *)view; @optional - (NSInteger)numberOfPlaceholdersInCarousel:(iCarousel *)carousel; - (UIView *)carousel:(iCarousel *)carousel placeholderViewAtIndex:(NSInteger)index reusingView:(nullable UIView *)view; @end @protocol iCarouselDelegate @optional - (void)carouselWillBeginScrollingAnimation:(iCarousel *)carousel; - (void)carouselDidEndScrollingAnimation:(iCarousel *)carousel; - (void)carouselDidScroll:(iCarousel *)carousel; - (void)carouselCurrentItemIndexDidChange:(iCarousel *)carousel; - (void)carouselWillBeginDragging:(iCarousel *)carousel; - (void)carouselDidEndDragging:(iCarousel *)carousel willDecelerate:(BOOL)decelerate; - (void)carouselWillBeginDecelerating:(iCarousel *)carousel; - (void)carouselDidEndDecelerating:(iCarousel *)carousel; - (BOOL)carousel:(iCarousel *)carousel shouldSelectItemAtIndex:(NSInteger)index; - (void)carousel:(iCarousel *)carousel didSelectItemAtIndex:(NSInteger)index; - (CGFloat)carouselItemWidth:(iCarousel *)carousel; - (CATransform3D)carousel:(iCarousel *)carousel itemTransformForOffset:(CGFloat)offset baseTransform:(CATransform3D)transform; - (CGFloat)carousel:(iCarousel *)carousel valueForOption:(iCarouselOption)option withDefault:(CGFloat)value; @end NS_ASSUME_NONNULL_END #pragma clang diagnostic pop ================================================ FILE: iCarousel/iCarousel.m ================================================ // // iCarousel.m // // Version 1.8.3 // // Created by Nick Lockwood on 01/04/2011. // Copyright 2011 Charcoal Design // // Distributed under the permissive zlib License // Get the latest version from here: // // https://github.com/nicklockwood/iCarousel // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // #import "iCarousel.h" #import #import #import #if !__has_feature(objc_arc) #error This class requires automatic reference counting #endif #if !defined(__has_warning) || __has_warning("-Wreceiver-is-weak") # pragma GCC diagnostic ignored "-Wreceiver-is-weak" #endif #pragma clang diagnostic ignored "-Warc-repeated-use-of-weak" #pragma clang diagnostic ignored "-Wobjc-missing-property-synthesis" #pragma clang diagnostic ignored "-Wdirect-ivar-access" #pragma clang diagnostic ignored "-Wunused-macros" #pragma clang diagnostic ignored "-Wconversion" #pragma clang diagnostic ignored "-Wformat-nonliteral" #pragma clang diagnostic ignored "-Wpartial-availability" #pragma clang diagnostic ignored "-Wdouble-promotion" #pragma clang diagnostic ignored "-Wselector" #pragma clang diagnostic ignored "-Wgnu" #define MIN_TOGGLE_DURATION 0.2 #define MAX_TOGGLE_DURATION 0.4 #define SCROLL_DURATION 0.4 #define INSERT_DURATION 0.4 #define DECELERATE_THRESHOLD 0.1 #define SCROLL_SPEED_THRESHOLD 2.0 #define SCROLL_DISTANCE_THRESHOLD 0.1 #define DECELERATION_MULTIPLIER 30.0 #define FLOAT_ERROR_MARGIN 0.000001 #ifdef ICAROUSEL_MACOS #define MAX_VISIBLE_ITEMS 50 #else #define MAX_VISIBLE_ITEMS 30 #endif @implementation NSObject (iCarousel) - (NSUInteger)numberOfPlaceholdersInCarousel:(__unused iCarousel *)carousel { return 0; } - (void)carouselWillBeginScrollingAnimation:(__unused iCarousel *)carousel {} - (void)carouselDidEndScrollingAnimation:(__unused iCarousel *)carousel {} - (void)carouselDidScroll:(__unused iCarousel *)carousel {} - (void)carouselCurrentItemIndexDidChange:(__unused iCarousel *)carousel {} - (void)carouselWillBeginDragging:(__unused iCarousel *)carousel {} - (void)carouselDidEndDragging:(__unused iCarousel *)carousel willDecelerate:(__unused BOOL)decelerate {} - (void)carouselWillBeginDecelerating:(__unused iCarousel *)carousel {} - (void)carouselDidEndDecelerating:(__unused iCarousel *)carousel {} - (BOOL)carousel:(__unused iCarousel *)carousel shouldSelectItemAtIndex:(__unused NSInteger)index { return YES; } - (void)carousel:(__unused iCarousel *)carousel didSelectItemAtIndex:(__unused NSInteger)index {} - (CGFloat)carouselItemWidth:(__unused iCarousel *)carousel { return 0; } - (CATransform3D)carousel:(__unused iCarousel *)carousel itemTransformForOffset:(__unused CGFloat)offset baseTransform:(CATransform3D)transform { return transform; } - (CGFloat)carousel:(__unused iCarousel *)carousel valueForOption:(__unused iCarouselOption)option withDefault:(CGFloat)value { return value; } @end @interface iCarousel () @property (nonatomic, strong) UIView *contentView; @property (nonatomic, strong) NSMutableDictionary *itemViews; @property (nonatomic, strong) NSMutableSet *itemViewPool; @property (nonatomic, strong) NSMutableSet *placeholderViewPool; @property (nonatomic, assign) CGFloat previousScrollOffset; @property (nonatomic, assign) NSInteger previousItemIndex; @property (nonatomic, assign) NSInteger numberOfPlaceholdersToShow; @property (nonatomic, assign) NSInteger numberOfVisibleItems; @property (nonatomic, assign) CGFloat itemWidth; @property (nonatomic, assign) CGFloat offsetMultiplier; @property (nonatomic, assign) CGFloat startOffset; @property (nonatomic, assign) CGFloat endOffset; @property (nonatomic, assign) NSTimeInterval scrollDuration; @property (nonatomic, assign, getter = isScrolling) BOOL scrolling; @property (nonatomic, assign) NSTimeInterval startTime; @property (nonatomic, assign) NSTimeInterval lastTime; @property (nonatomic, assign) CGFloat startVelocity; @property (nonatomic, strong) NSTimer *timer; @property (nonatomic, assign, getter = isDecelerating) BOOL decelerating; @property (nonatomic, assign) CGFloat previousTranslation; @property (nonatomic, assign, getter = isWrapEnabled) BOOL wrapEnabled; @property (nonatomic, assign, getter = isDragging) BOOL dragging; @property (nonatomic, assign) BOOL didDrag; @property (nonatomic, assign) NSTimeInterval toggleTime; NSComparisonResult compareViewDepth(UIView *view1, UIView *view2, iCarousel *self); @end @implementation iCarousel #pragma mark - #pragma mark Initialisation - (void)setUp { _decelerationRate = 0.95; _scrollEnabled = YES; _bounces = YES; _offsetMultiplier = 1.0; _perspective = -1.0/500.0; _contentOffset = CGSizeZero; _viewpointOffset = CGSizeZero; _scrollSpeed = 1.0; _bounceDistance = 1.0; _stopAtItemBoundary = YES; _scrollToItemBoundary = YES; _ignorePerpendicularSwipes = YES; _centerItemWhenSelected = YES; _contentView = [[UIView alloc] initWithFrame:self.bounds]; #ifdef ICAROUSEL_IOS _contentView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; //add pan gesture recogniser UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(didPan:)]; panGesture.delegate = (id )self; [_contentView addGestureRecognizer:panGesture]; //add tap gesture recogniser UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTap:)]; tapGesture.delegate = (id )self; [_contentView addGestureRecognizer:tapGesture]; //set up accessibility self.accessibilityTraits = UIAccessibilityTraitAllowsDirectInteraction; self.isAccessibilityElement = YES; #else [_contentView setWantsLayer:YES]; #endif [self addSubview:_contentView]; if (_dataSource) { [self reloadData]; } } #ifndef USING_CHAMELEON - (id)initWithCoder:(NSCoder *)aDecoder { if ((self = [super initWithCoder:aDecoder])) { [self setUp]; if (self.superview) { [self startAnimation]; } } return self; } #endif #ifdef ICAROUSEL_IOS - (id)initWithFrame:(CGRect)frame #else - (id)initWithFrame:(NSRect)frame #endif { if ((self = [super initWithFrame:frame])) { [self setUp]; } return self; } - (void)dealloc { [self stopAnimation]; } - (void)setDataSource:(id)dataSource { if (_dataSource != dataSource) { _dataSource = dataSource; if (_dataSource) { [self reloadData]; } } } - (void)setDelegate:(id)delegate { if (_delegate != delegate) { _delegate = delegate; if (_delegate && _dataSource) { [self setNeedsLayout]; } } } - (void)setType:(iCarouselType)type { if (_type != type) { _type = type; [self layOutItemViews]; } } - (void)setVertical:(BOOL)vertical { if (_vertical != vertical) { _vertical = vertical; [self layOutItemViews]; } } - (void)setScrollOffset:(CGFloat)scrollOffset { _scrolling = NO; _decelerating = NO; _startOffset = scrollOffset; _endOffset = scrollOffset; if (fabs(_scrollOffset - scrollOffset) > 0.0) { _scrollOffset = scrollOffset; [self depthSortViews]; [self didScroll]; } } - (void)setCurrentItemIndex:(NSInteger)currentItemIndex { [self setScrollOffset:currentItemIndex]; } - (void)setPerspective:(CGFloat)perspective { _perspective = perspective; [self transformItemViews]; } - (void)setViewpointOffset:(CGSize)viewpointOffset { if (!CGSizeEqualToSize(_viewpointOffset, viewpointOffset)) { _viewpointOffset = viewpointOffset; [self transformItemViews]; } } - (void)setContentOffset:(CGSize)contentOffset { if (!CGSizeEqualToSize(_contentOffset, contentOffset)) { _contentOffset = contentOffset; [self layOutItemViews]; } } - (void)setAutoscroll:(CGFloat)autoscroll { _autoscroll = autoscroll; if (autoscroll != 0.0) [self startAnimation]; } - (void)pushAnimationState:(BOOL)enabled { [CATransaction begin]; [CATransaction setDisableActions:!enabled]; } - (void)popAnimationState { [CATransaction commit]; } #pragma mark - #pragma mark View management - (NSArray *)indexesForVisibleItems { return [[_itemViews allKeys] sortedArrayUsingSelector:@selector(compare:)]; } - (NSArray *)visibleItemViews { NSArray *indexes = [self indexesForVisibleItems]; return [_itemViews objectsForKeys:indexes notFoundMarker:[NSNull null]]; } - (UIView *)itemViewAtIndex:(NSInteger)index { return _itemViews[@(index)]; } - (UIView *)currentItemView { return [self itemViewAtIndex:self.currentItemIndex]; } - (NSInteger)indexOfItemView:(UIView *)view { NSInteger index = [[_itemViews allValues] indexOfObject:view]; if (index != NSNotFound) { return [[_itemViews allKeys][index] integerValue]; } return NSNotFound; } - (NSInteger)indexOfItemViewOrSubview:(UIView *)view { NSInteger index = [self indexOfItemView:view]; if (index == NSNotFound && view.superview && view != _contentView) { return [self indexOfItemViewOrSubview:(UIView *__nonnull)view.superview]; } return index; } - (UIView *)itemViewAtPoint:(CGPoint)point { for (UIView *view in [[[_itemViews allValues] sortedArrayUsingFunction:(NSInteger (*)(id, id, void *))compareViewDepth context:(__bridge void *)self] reverseObjectEnumerator]) { if ([view.superview.layer hitTest:point]) { return view; } } return nil; } - (void)setItemView:(UIView *)view forIndex:(NSInteger)index { _itemViews[@(index)] = view; } - (void)removeViewAtIndex:(NSInteger)index { NSMutableDictionary *newItemViews = [NSMutableDictionary dictionaryWithCapacity:[_itemViews count] - 1]; for (NSNumber *number in [self indexesForVisibleItems]) { NSInteger i = [number integerValue]; if (i < index) { newItemViews[number] = _itemViews[number]; } else if (i > index) { newItemViews[@(i - 1)] = _itemViews[number]; } } self.itemViews = newItemViews; } - (void)insertView:(UIView *)view atIndex:(NSInteger)index { NSMutableDictionary *newItemViews = [NSMutableDictionary dictionaryWithCapacity:[_itemViews count] + 1]; for (NSNumber *number in [self indexesForVisibleItems]) { NSInteger i = [number integerValue]; if (i < index) { newItemViews[number] = _itemViews[number]; } else { newItemViews[@(i + 1)] = _itemViews[number]; } } if (view) { [self setItemView:view forIndex:index]; } self.itemViews = newItemViews; } #pragma mark - #pragma mark View layout - (CGFloat)alphaForItemWithOffset:(CGFloat)offset { CGFloat fadeMin = (CGFloat)-INFINITY; CGFloat fadeMax = (CGFloat)INFINITY; CGFloat fadeRange = 1.0; CGFloat fadeMinAlpha = 0.0; switch (_type) { case iCarouselTypeTimeMachine: { fadeMax = 0.0; break; } case iCarouselTypeInvertedTimeMachine: { fadeMin = 0.0; break; } case iCarouselTypeCoverFlow: case iCarouselTypeCoverFlow2: case iCarouselTypeCustom: case iCarouselTypeCylinder: case iCarouselTypeInvertedCylinder: case iCarouselTypeRotary: case iCarouselTypeInvertedRotary: case iCarouselTypeWheel: case iCarouselTypeInvertedWheel: case iCarouselTypeLinear: { //do nothing } } fadeMin = [self valueForOption:iCarouselOptionFadeMin withDefault:fadeMin]; fadeMax = [self valueForOption:iCarouselOptionFadeMax withDefault:fadeMax]; fadeRange = [self valueForOption:iCarouselOptionFadeRange withDefault:fadeRange]; fadeMinAlpha = [self valueForOption:iCarouselOptionFadeMinAlpha withDefault:fadeMinAlpha]; #ifdef ICAROUSEL_MACOS if (_vertical) { //invert offset = -offset; } #endif CGFloat factor = 0.0; if (offset > fadeMax) { factor = offset - fadeMax; } else if (offset < fadeMin) { factor = fadeMin - offset; } return 1.0 - MIN(factor, fadeRange) / fadeRange * (1.0 - fadeMinAlpha); } - (CGFloat)valueForOption:(iCarouselOption)option withDefault:(CGFloat)value { return _delegate? [_delegate carousel:self valueForOption:option withDefault:value]: value; } - (CATransform3D)transformForItemViewWithOffset:(CGFloat)offset { //set up base transform CATransform3D transform = CATransform3DIdentity; transform.m34 = _perspective; transform = CATransform3DTranslate(transform, -_viewpointOffset.width, -_viewpointOffset.height, 0.0); //perform transform switch (_type) { case iCarouselTypeCustom: { return [_delegate carousel:self itemTransformForOffset:offset baseTransform:transform]; } case iCarouselTypeLinear: { CGFloat spacing = [self valueForOption:iCarouselOptionSpacing withDefault:1.0]; if (_vertical) { return CATransform3DTranslate(transform, 0.0, offset * _itemWidth * spacing, 0.0); } else { return CATransform3DTranslate(transform, offset * _itemWidth * spacing, 0.0, 0.0); } } case iCarouselTypeRotary: case iCarouselTypeInvertedRotary: { CGFloat count = [self circularCarouselItemCount]; CGFloat spacing = [self valueForOption:iCarouselOptionSpacing withDefault:1.0]; CGFloat arc = [self valueForOption:iCarouselOptionArc withDefault:M_PI * 2.0]; CGFloat radius = [self valueForOption:iCarouselOptionRadius withDefault:MAX(_itemWidth * spacing / 2.0, _itemWidth * spacing / 2.0 / tan(arc/2.0/count))]; CGFloat angle = [self valueForOption:iCarouselOptionAngle withDefault:offset / count * arc]; if (_type == iCarouselTypeInvertedRotary) { radius = -radius; angle = -angle; } if (_vertical) { return CATransform3DTranslate(transform, 0.0, radius * sin(angle), radius * cos(angle) - radius); } else { return CATransform3DTranslate(transform, radius * sin(angle), 0.0, radius * cos(angle) - radius); } } case iCarouselTypeCylinder: case iCarouselTypeInvertedCylinder: { CGFloat count = [self circularCarouselItemCount]; CGFloat spacing = [self valueForOption:iCarouselOptionSpacing withDefault:1.0]; CGFloat arc = [self valueForOption:iCarouselOptionArc withDefault:M_PI * 2.0]; CGFloat radius = [self valueForOption:iCarouselOptionRadius withDefault:MAX(0.01, _itemWidth * spacing / 2.0 / tan(arc/2.0/count))]; CGFloat angle = [self valueForOption:iCarouselOptionAngle withDefault:offset / count * arc]; if (_type == iCarouselTypeInvertedCylinder) { radius = -radius; angle = -angle; } if (_vertical) { transform = CATransform3DTranslate(transform, 0.0, 0.0, -radius); transform = CATransform3DRotate(transform, angle, -1.0, 0.0, 0.0); return CATransform3DTranslate(transform, 0.0, 0.0, radius + 0.01); } else { transform = CATransform3DTranslate(transform, 0.0, 0.0, -radius); transform = CATransform3DRotate(transform, angle, 0.0, 1.0, 0.0); return CATransform3DTranslate(transform, 0.0, 0.0, radius + 0.01); } } case iCarouselTypeWheel: case iCarouselTypeInvertedWheel: { CGFloat count = [self circularCarouselItemCount]; CGFloat spacing = [self valueForOption:iCarouselOptionSpacing withDefault:1.0]; CGFloat arc = [self valueForOption:iCarouselOptionArc withDefault:M_PI * 2.0]; CGFloat radius = [self valueForOption:iCarouselOptionRadius withDefault:_itemWidth * spacing * count / arc]; CGFloat angle = [self valueForOption:iCarouselOptionAngle withDefault:arc / count]; if (_type == iCarouselTypeInvertedWheel) { radius = -radius; angle = -angle; } if (_vertical) { transform = CATransform3DTranslate(transform, -radius, 0.0, 0.0); transform = CATransform3DRotate(transform, angle * offset, 0.0, 0.0, 1.0); return CATransform3DTranslate(transform, radius, 0.0, offset * 0.01); } else { transform = CATransform3DTranslate(transform, 0.0, radius, 0.0); transform = CATransform3DRotate(transform, angle * offset, 0.0, 0.0, 1.0); return CATransform3DTranslate(transform, 0.0, -radius, offset * 0.01); } } case iCarouselTypeCoverFlow: case iCarouselTypeCoverFlow2: { CGFloat tilt = [self valueForOption:iCarouselOptionTilt withDefault:0.9]; CGFloat spacing = [self valueForOption:iCarouselOptionSpacing withDefault:0.25]; CGFloat clampedOffset = MAX(-1.0, MIN(1.0, offset)); if (_type == iCarouselTypeCoverFlow2) { if (_toggle > 0.0) { if (offset <= -0.5) { clampedOffset = -1.0; } else if (offset <= 0.5) { clampedOffset = -_toggle; } else if (offset <= 1.5) { clampedOffset = 1.0 - _toggle; } } else { if (offset > 0.5) { clampedOffset = 1.0; } else if (offset > -0.5) { clampedOffset = -_toggle; } else if (offset > -1.5) { clampedOffset = - 1.0 - _toggle; } } } CGFloat x = (clampedOffset * 0.5 * tilt + offset * spacing) * _itemWidth; CGFloat z = fabs(clampedOffset) * -_itemWidth * 0.5; if (_vertical) { transform = CATransform3DTranslate(transform, 0.0, x, z); return CATransform3DRotate(transform, -clampedOffset * M_PI_2 * tilt, -1.0, 0.0, 0.0); } else { transform = CATransform3DTranslate(transform, x, 0.0, z); return CATransform3DRotate(transform, -clampedOffset * M_PI_2 * tilt, 0.0, 1.0, 0.0); } } case iCarouselTypeTimeMachine: case iCarouselTypeInvertedTimeMachine: { CGFloat tilt = [self valueForOption:iCarouselOptionTilt withDefault:0.3]; CGFloat spacing = [self valueForOption:iCarouselOptionSpacing withDefault:1.0]; if (_type == iCarouselTypeInvertedTimeMachine) { tilt = -tilt; offset = -offset; } if (_vertical) { #ifdef ICAROUSEL_MACOS //invert again tilt = -tilt; offset = -offset; #endif return CATransform3DTranslate(transform, 0.0, offset * _itemWidth * tilt, offset * _itemWidth * spacing); } else { return CATransform3DTranslate(transform, offset * _itemWidth * tilt, 0.0, offset * _itemWidth * spacing); } } } } NSComparisonResult compareViewDepth(UIView *view1, UIView *view2, iCarousel *self) { //compare depths CATransform3D t1 = view1.superview.layer.transform; CATransform3D t2 = view2.superview.layer.transform; CGFloat z1 = t1.m13 + t1.m23 + t1.m33 + t1.m43; CGFloat z2 = t2.m13 + t2.m23 + t2.m33 + t2.m43; CGFloat difference = z1 - z2; //if depths are equal, compare distance from current view if (difference == 0.0) { CATransform3D t3 = [self currentItemView].superview.layer.transform; if (self.vertical) { CGFloat y1 = t1.m12 + t1.m22 + t1.m32 + t1.m42; CGFloat y2 = t2.m12 + t2.m22 + t2.m32 + t2.m42; CGFloat y3 = t3.m12 + t3.m22 + t3.m32 + t3.m42; difference = fabs(y2 - y3) - fabs(y1 - y3); } else { CGFloat x1 = t1.m11 + t1.m21 + t1.m31 + t1.m41; CGFloat x2 = t2.m11 + t2.m21 + t2.m31 + t2.m41; CGFloat x3 = t3.m11 + t3.m21 + t3.m31 + t3.m41; difference = fabs(x2 - x3) - fabs(x1 - x3); } } return (difference < 0.0)? NSOrderedAscending: NSOrderedDescending; } #ifdef ICAROUSEL_IOS - (void)depthSortViews { for (UIView *view in [[_itemViews allValues] sortedArrayUsingFunction:(NSInteger (*)(id, id, void *))compareViewDepth context:(__bridge void *)self]) { [_contentView bringSubviewToFront:(UIView *__nonnull)view.superview]; } } #else - (void)setNeedsLayout { [self setNeedsLayout:YES]; } - (void)depthSortViews { //does nothing on Mac OS } #endif - (CGFloat)offsetForItemAtIndex:(NSInteger)index { //calculate relative position CGFloat offset = index - _scrollOffset; if (_wrapEnabled) { if (offset > _numberOfItems/2.0) { offset -= _numberOfItems; } else if (offset < -_numberOfItems/2.0) { offset += _numberOfItems; } } #ifdef ICAROUSEL_MACOS if (_vertical) { //invert transform offset = -offset; } #endif return offset; } - (UIView *)containView:(UIView *)view { //set item width if (!_itemWidth) { _itemWidth = _vertical? view.bounds.size.height: view.bounds.size.width; } //set container frame CGRect frame = view.bounds; frame.size.width = _vertical? frame.size.width: _itemWidth; frame.size.height = _vertical? _itemWidth: frame.size.height; UIView *containerView = [[UIView alloc] initWithFrame:frame]; #ifdef ICAROUSEL_MACOS //clipping works differently on Mac OS [containerView setBoundsSize:view.frame.size]; #endif //set view frame frame = view.frame; frame.origin.x = (containerView.bounds.size.width - frame.size.width) / 2.0; frame.origin.y = (containerView.bounds.size.height - frame.size.height) / 2.0; view.frame = frame; [containerView addSubview:view]; containerView.layer.opacity = 0; return containerView; } - (void)transformItemView:(UIView *)view atIndex:(NSInteger)index { //calculate offset CGFloat offset = [self offsetForItemAtIndex:index]; //update alpha view.superview.layer.opacity = [self alphaForItemWithOffset:offset]; #ifdef ICAROUSEL_IOS //center view view.superview.center = CGPointMake(self.bounds.size.width/2.0 + _contentOffset.width, self.bounds.size.height/2.0 + _contentOffset.height); //enable/disable interaction view.superview.userInteractionEnabled = (!_centerItemWhenSelected || index == self.currentItemIndex); //account for retina view.superview.layer.rasterizationScale = [UIScreen mainScreen].scale; [view layoutIfNeeded]; #else //center view [view.superview setFrameOrigin:NSMakePoint(self.bounds.size.width/2.0 + _contentOffset.width, self.bounds.size.height/2.0 + _contentOffset.height)]; view.superview.layer.anchorPoint = CGPointMake(0.5, 0.5); //account for retina view.superview.layer.rasterizationScale = view.window.screen.backingScaleFactor; #endif //special-case logic for iCarouselTypeCoverFlow2 CGFloat clampedOffset = MAX(-1.0, MIN(1.0, offset)); if (_decelerating || (_scrolling && !_dragging && !_didDrag) || (_autoscroll && !_dragging) || (!_wrapEnabled && (_scrollOffset < 0 || _scrollOffset >= _numberOfItems - 1))) { if (offset > 0) { _toggle = (offset <= 0.5)? -clampedOffset: (1.0 - clampedOffset); } else { _toggle = (offset > -0.5)? -clampedOffset: (- 1.0 - clampedOffset); } } //calculate transform CATransform3D transform = [self transformForItemViewWithOffset:offset]; //transform view view.superview.layer.transform = transform; //backface culling BOOL showBackfaces = view.layer.doubleSided; if (showBackfaces) { switch (_type) { case iCarouselTypeInvertedCylinder: { showBackfaces = NO; break; } case iCarouselTypeCoverFlow: case iCarouselTypeCoverFlow2: case iCarouselTypeCustom: case iCarouselTypeCylinder: case iCarouselTypeRotary: case iCarouselTypeInvertedRotary: case iCarouselTypeWheel: case iCarouselTypeInvertedWheel: case iCarouselTypeLinear: case iCarouselTypeTimeMachine: case iCarouselTypeInvertedTimeMachine: { showBackfaces = YES; break; } } } showBackfaces = !![self valueForOption:iCarouselOptionShowBackfaces withDefault:showBackfaces]; //we can't just set the layer.doubleSided property because it doesn't block interaction //instead we'll calculate if the view is front-facing based on the transform view.superview.hidden = !(showBackfaces ?: (transform.m33 > 0.0)); } #ifdef ICAROUSEL_MACOS - (void)resizeSubviewsWithOldSize:(__unused NSSize)oldSize { [self pushAnimationState:NO]; _contentView.frame = self.bounds; [self layOutItemViews]; [self popAnimationState]; } #else - (void)layoutSubviews { [super layoutSubviews]; _contentView.frame = self.bounds; [self layOutItemViews]; } #endif - (void)transformItemViews { for (NSNumber *number in _itemViews) { NSInteger index = [number integerValue]; UIView *view = _itemViews[number]; [self transformItemView:view atIndex:index]; } } - (void)updateItemWidth { _itemWidth = [_delegate carouselItemWidth:self] ?: _itemWidth; if (_numberOfItems > 0) { if ([_itemViews count] == 0) { [self loadViewAtIndex:0]; } } else if (_numberOfPlaceholders > 0) { if ([_itemViews count] == 0) { [self loadViewAtIndex:-1]; } } } - (void)updateNumberOfVisibleItems { //get number of visible items switch (_type) { case iCarouselTypeLinear: { //exact number required to fill screen CGFloat spacing = [self valueForOption:iCarouselOptionSpacing withDefault:1.0]; CGFloat width = _vertical ? self.bounds.size.height: self.bounds.size.width; CGFloat itemWidth = _itemWidth * spacing; _numberOfVisibleItems = ceil(width / itemWidth) + 2; break; } case iCarouselTypeCoverFlow: case iCarouselTypeCoverFlow2: { //exact number required to fill screen CGFloat spacing = [self valueForOption:iCarouselOptionSpacing withDefault:0.25]; CGFloat width = _vertical ? self.bounds.size.height: self.bounds.size.width; CGFloat itemWidth = _itemWidth * spacing; _numberOfVisibleItems = ceil(width / itemWidth) + 2; break; } case iCarouselTypeRotary: case iCarouselTypeCylinder: { //based on count value _numberOfVisibleItems = [self circularCarouselItemCount]; break; } case iCarouselTypeInvertedRotary: case iCarouselTypeInvertedCylinder: { //TODO: improve this _numberOfVisibleItems = ceil([self circularCarouselItemCount] / 2.0); break; } case iCarouselTypeWheel: case iCarouselTypeInvertedWheel: { //TODO: improve this CGFloat count = [self circularCarouselItemCount]; CGFloat spacing = [self valueForOption:iCarouselOptionSpacing withDefault:1.0]; CGFloat arc = [self valueForOption:iCarouselOptionArc withDefault:M_PI * 2.0]; CGFloat radius = [self valueForOption:iCarouselOptionRadius withDefault:_itemWidth * spacing * count / arc]; if (radius - _itemWidth / 2.0 < MIN(self.bounds.size.width, self.bounds.size.height) / 2.0) { _numberOfVisibleItems = count; } else { _numberOfVisibleItems = ceil(count / 2.0) + 1; } break; } case iCarouselTypeTimeMachine: case iCarouselTypeInvertedTimeMachine: case iCarouselTypeCustom: { //slightly arbitrary number, chosen for performance reasons _numberOfVisibleItems = MAX_VISIBLE_ITEMS; break; } } _numberOfVisibleItems = MIN(MAX_VISIBLE_ITEMS, _numberOfVisibleItems); _numberOfVisibleItems = [self valueForOption:iCarouselOptionVisibleItems withDefault:_numberOfVisibleItems]; _numberOfVisibleItems = MAX(0, MIN(_numberOfVisibleItems, _numberOfItems + _numberOfPlaceholdersToShow)); } - (NSInteger)circularCarouselItemCount { NSInteger count = 0; switch (_type) { case iCarouselTypeRotary: case iCarouselTypeInvertedRotary: case iCarouselTypeCylinder: case iCarouselTypeInvertedCylinder: case iCarouselTypeWheel: case iCarouselTypeInvertedWheel: { //slightly arbitrary number, chosen for aesthetic reasons CGFloat spacing = [self valueForOption:iCarouselOptionSpacing withDefault:1.0]; CGFloat width = _vertical ? self.bounds.size.height: self.bounds.size.width; count = MIN(MAX_VISIBLE_ITEMS, MAX(12, ceil(width / (spacing * _itemWidth)) * M_PI)); count = MIN(_numberOfItems + _numberOfPlaceholdersToShow, count); break; } case iCarouselTypeCoverFlow: case iCarouselTypeCoverFlow2: case iCarouselTypeTimeMachine: case iCarouselTypeInvertedTimeMachine: case iCarouselTypeLinear: case iCarouselTypeCustom: { //not used for non-circular carousels return _numberOfItems + _numberOfPlaceholdersToShow; } } return [self valueForOption:iCarouselOptionCount withDefault:count]; } - (void)layOutItemViews { //bail out if not set up yet if (!_dataSource || !_contentView) { return; } //update wrap switch (_type) { case iCarouselTypeRotary: case iCarouselTypeInvertedRotary: case iCarouselTypeCylinder: case iCarouselTypeInvertedCylinder: case iCarouselTypeWheel: case iCarouselTypeInvertedWheel: { _wrapEnabled = YES; break; } case iCarouselTypeCoverFlow: case iCarouselTypeCoverFlow2: case iCarouselTypeTimeMachine: case iCarouselTypeInvertedTimeMachine: case iCarouselTypeLinear: case iCarouselTypeCustom: { _wrapEnabled = NO; break; } } _wrapEnabled = !![self valueForOption:iCarouselOptionWrap withDefault:_wrapEnabled]; //no placeholders on wrapped carousels _numberOfPlaceholdersToShow = _wrapEnabled? 0: _numberOfPlaceholders; //set item width [self updateItemWidth]; //update number of visible items [self updateNumberOfVisibleItems]; //prevent false index changed event _previousScrollOffset = self.scrollOffset; //update offset multiplier switch (_type) { case iCarouselTypeCoverFlow: case iCarouselTypeCoverFlow2: { _offsetMultiplier = 2.0; break; } case iCarouselTypeCylinder: case iCarouselTypeInvertedCylinder: case iCarouselTypeWheel: case iCarouselTypeInvertedWheel: case iCarouselTypeRotary: case iCarouselTypeInvertedRotary: case iCarouselTypeTimeMachine: case iCarouselTypeInvertedTimeMachine: case iCarouselTypeLinear: case iCarouselTypeCustom: { _offsetMultiplier = 1.0; break; } } _offsetMultiplier = [self valueForOption:iCarouselOptionOffsetMultiplier withDefault:_offsetMultiplier]; //align if (!_scrolling && !_decelerating && !_autoscroll) { if (_scrollToItemBoundary && self.currentItemIndex != -1) { [self scrollToItemAtIndex:self.currentItemIndex animated:YES]; } else { _scrollOffset = [self clampedOffset:_scrollOffset]; } } //update views [self didScroll]; } #pragma mark - #pragma mark View queing - (void)queueItemView:(UIView *)view { if (view) { [_itemViewPool addObject:view]; } } - (void)queuePlaceholderView:(UIView *)view { if (view) { [_placeholderViewPool addObject:view]; } } - (UIView *)dequeueItemView { UIView *view = [_itemViewPool anyObject]; if (view) { [_itemViewPool removeObject:view]; } return view; } - (UIView *)dequeuePlaceholderView { UIView *view = [_placeholderViewPool anyObject]; if (view) { [_placeholderViewPool removeObject:view]; } return view; } #pragma mark - #pragma mark View loading - (UIView *)loadViewAtIndex:(NSInteger)index withContainerView:(UIView *)containerView { [self pushAnimationState:NO]; UIView *view = nil; if (index < 0) { view = [_dataSource carousel:self placeholderViewAtIndex:(NSInteger)(ceil((CGFloat)_numberOfPlaceholdersToShow/2.0)) + index reusingView:[self dequeuePlaceholderView]]; } else if (index >= _numberOfItems) { view = [_dataSource carousel:self placeholderViewAtIndex:_numberOfPlaceholdersToShow/2.0 + index - _numberOfItems reusingView:[self dequeuePlaceholderView]]; } else { view = [_dataSource carousel:self viewForItemAtIndex:index reusingView:[self dequeueItemView]]; } if (view == nil) { view = [[UIView alloc] init]; } [self setItemView:view forIndex:index]; if (containerView) { //get old item view UIView *oldItemView = [containerView.subviews lastObject]; if (index < 0 || index >= _numberOfItems) { [self queuePlaceholderView:oldItemView]; } else { [self queueItemView:oldItemView]; } //set container frame CGRect frame = containerView.bounds; if(_vertical) { frame.size.width = view.frame.size.width; frame.size.height = MIN(_itemWidth, view.frame.size.height); } else { frame.size.width = MIN(_itemWidth, view.frame.size.width); frame.size.height = view.frame.size.height; } containerView.bounds = frame; #ifdef ICAROUSEL_MACOS //clipping works differently on Mac OS [containerView setBoundsSize:view.frame.size]; #endif //set view frame frame = view.frame; frame.origin.x = (containerView.bounds.size.width - frame.size.width) / 2.0; frame.origin.y = (containerView.bounds.size.height - frame.size.height) / 2.0; view.frame = frame; //switch views [oldItemView removeFromSuperview]; [containerView addSubview:view]; } else { [_contentView addSubview:[self containView:view]]; } view.superview.layer.opacity = 0.0; [self transformItemView:view atIndex:index]; [self popAnimationState]; return view; } - (UIView *)loadViewAtIndex:(NSInteger)index { return [self loadViewAtIndex:index withContainerView:nil]; } - (void)loadUnloadViews { //set item width [self updateItemWidth]; //update number of visible items [self updateNumberOfVisibleItems]; //calculate visible view indices NSMutableSet *visibleIndices = [NSMutableSet setWithCapacity:_numberOfVisibleItems]; NSInteger min = -(NSInteger)(ceil((CGFloat)_numberOfPlaceholdersToShow/2.0)); NSInteger max = _numberOfItems - 1 + _numberOfPlaceholdersToShow/2; NSInteger offset = self.currentItemIndex - _numberOfVisibleItems/2; if (!_wrapEnabled) { offset = MAX(min, MIN(max - _numberOfVisibleItems + 1, offset)); } for (NSInteger i = 0; i < _numberOfVisibleItems; i++) { NSInteger index = i + offset; if (_wrapEnabled) { index = [self clampedIndex:index]; } CGFloat alpha = [self alphaForItemWithOffset:[self offsetForItemAtIndex:index]]; if (alpha) { //only add views with alpha > 0 [visibleIndices addObject:@(index)]; } } //remove offscreen views for (NSNumber *number in [_itemViews allKeys]) { if (![visibleIndices containsObject:number]) { UIView *view = _itemViews[number]; if ([number integerValue] < 0 || [number integerValue] >= _numberOfItems) { [self queuePlaceholderView:view]; } else { [self queueItemView:view]; } [view.superview removeFromSuperview]; [(NSMutableDictionary *)_itemViews removeObjectForKey:number]; } } //add onscreen views for (NSNumber *number in visibleIndices) { UIView *view = _itemViews[number]; if (view == nil) { [self loadViewAtIndex:[number integerValue]]; } } } - (void)reloadData { //remove old views for (UIView *view in [_itemViews allValues]) { [view.superview removeFromSuperview]; } //bail out if not set up yet if (!_dataSource || !_contentView) { return; } //get number of items and placeholders _numberOfVisibleItems = 0; _numberOfItems = [_dataSource numberOfItemsInCarousel:self]; _numberOfPlaceholders = [_dataSource numberOfPlaceholdersInCarousel:self]; //reset view pools self.itemViews = [NSMutableDictionary dictionary]; self.itemViewPool = [NSMutableSet set]; self.placeholderViewPool = [NSMutableSet setWithCapacity:_numberOfPlaceholders]; //layout views [self setNeedsLayout]; //fix scroll offset if (_numberOfItems > 0 && _scrollOffset < 0.0) { [self scrollToItemAtIndex:0 animated:(_numberOfPlaceholders > 0)]; } } #pragma mark - #pragma mark Scrolling - (NSInteger)clampedIndex:(NSInteger)index { if (_numberOfItems == 0) { return -1; } else if (_wrapEnabled) { return index - floor((CGFloat)index / (CGFloat)_numberOfItems) * _numberOfItems; } else { return MIN(MAX(0, index), MAX(0, _numberOfItems - 1)); } } - (CGFloat)clampedOffset:(CGFloat)offset { if (_numberOfItems == 0) { return -1.0; } else if (_wrapEnabled) { return offset - floor(offset / (CGFloat)_numberOfItems) * _numberOfItems; } else { return MIN(MAX(0.0, offset), MAX(0.0, (CGFloat)_numberOfItems - 1.0)); } } - (NSInteger)currentItemIndex { return [self clampedIndex:round(_scrollOffset)]; } - (NSInteger)minScrollDistanceFromIndex:(NSInteger)fromIndex toIndex:(NSInteger)toIndex { NSInteger directDistance = toIndex - fromIndex; if (_wrapEnabled) { NSInteger wrappedDistance = MIN(toIndex, fromIndex) + _numberOfItems - MAX(toIndex, fromIndex); if (fromIndex < toIndex) { wrappedDistance = -wrappedDistance; } return (ABS(directDistance) <= ABS(wrappedDistance))? directDistance: wrappedDistance; } return directDistance; } - (CGFloat)minScrollDistanceFromOffset:(CGFloat)fromOffset toOffset:(CGFloat)toOffset { CGFloat directDistance = toOffset - fromOffset; if (_wrapEnabled) { CGFloat wrappedDistance = MIN(toOffset, fromOffset) + _numberOfItems - MAX(toOffset, fromOffset); if (fromOffset < toOffset) { wrappedDistance = -wrappedDistance; } return (fabs(directDistance) <= fabs(wrappedDistance))? directDistance: wrappedDistance; } return directDistance; } - (void)scrollByOffset:(CGFloat)offset duration:(NSTimeInterval)duration { if (duration > 0.0) { _decelerating = NO; _scrolling = YES; _startTime = CACurrentMediaTime(); _startOffset = _scrollOffset; _scrollDuration = duration; _endOffset = _startOffset + offset; if (!_wrapEnabled) { _endOffset = [self clampedOffset:_endOffset]; } [_delegate carouselWillBeginScrollingAnimation:self]; [self startAnimation]; } else { self.scrollOffset += offset; } } - (void)scrollToOffset:(CGFloat)offset duration:(NSTimeInterval)duration { [self scrollByOffset:[self minScrollDistanceFromOffset:_scrollOffset toOffset:offset] duration:duration]; } - (void)scrollByNumberOfItems:(NSInteger)itemCount duration:(NSTimeInterval)duration { if (duration > 0.0) { CGFloat offset = 0.0; if (itemCount > 0) { offset = (floor(_scrollOffset) + itemCount) - _scrollOffset; } else if (itemCount < 0) { offset = (ceil(_scrollOffset) + itemCount) - _scrollOffset; } else { offset = round(_scrollOffset) - _scrollOffset; } [self scrollByOffset:offset duration:duration]; } else { self.scrollOffset = [self clampedIndex:_previousItemIndex + itemCount]; } } - (void)scrollToItemAtIndex:(NSInteger)index duration:(NSTimeInterval)duration { [self scrollToOffset:index duration:duration]; } - (void)scrollToItemAtIndex:(NSInteger)index animated:(BOOL)animated { [self scrollToItemAtIndex:index duration:animated? SCROLL_DURATION: 0]; } - (void)removeItemAtIndex:(NSInteger)index animated:(BOOL)animated { index = [self clampedIndex:index]; UIView *itemView = [self itemViewAtIndex:index]; if (animated) { #ifdef ICAROUSEL_IOS [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.1]; [UIView setAnimationDelegate:itemView.superview]; [UIView setAnimationDidStopSelector:@selector(removeFromSuperview)]; [self performSelector:@selector(queueItemView:) withObject:itemView afterDelay:0.1]; itemView.superview.layer.opacity = 0.0; [UIView commitAnimations]; [UIView beginAnimations:nil context:nil]; [UIView setAnimationDelay:0.1]; [UIView setAnimationDuration:INSERT_DURATION]; [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(depthSortViews)]; [self removeViewAtIndex:index]; _numberOfItems --; _wrapEnabled = !![self valueForOption:iCarouselOptionWrap withDefault:_wrapEnabled]; [self updateNumberOfVisibleItems]; _scrollOffset = self.currentItemIndex; [self didScroll]; [UIView commitAnimations]; #else [NSAnimationContext beginGrouping]; [[NSAnimationContext currentContext] setAllowsImplicitAnimation:YES]; [CATransaction begin]; [CATransaction setAnimationDuration:0.1]; [CATransaction setCompletionBlock:^{ [self queueItemView:itemView]; [itemView.superview removeFromSuperview]; }]; itemView.superview.layer.opacity = 0.0; [CATransaction commit]; [CATransaction begin]; [CATransaction setAnimationDuration:INSERT_DURATION]; [CATransaction setCompletionBlock:^{ [self depthSortViews]; }]; [self removeViewAtIndex:index]; _numberOfItems --; _wrapEnabled = !![self valueForOption:iCarouselOptionWrap withDefault:_wrapEnabled]; _scrollOffset = self.currentItemIndex; [self didScroll]; [CATransaction commit]; [NSAnimationContext endGrouping]; #endif } else { [self pushAnimationState:NO]; [self queueItemView:itemView]; [itemView.superview removeFromSuperview]; [self removeViewAtIndex:index]; _numberOfItems --; _wrapEnabled = !![self valueForOption:iCarouselOptionWrap withDefault:_wrapEnabled]; _scrollOffset = self.currentItemIndex; [self didScroll]; [self depthSortViews]; [self popAnimationState]; } } - (void)insertItemAtIndex:(NSInteger)index animated:(BOOL)animated { _numberOfItems ++; _wrapEnabled = !![self valueForOption:iCarouselOptionWrap withDefault:_wrapEnabled]; [self updateNumberOfVisibleItems]; index = [self clampedIndex:index]; [self insertView:nil atIndex:index]; [self loadViewAtIndex:index]; if (fabs(_itemWidth) < FLOAT_ERROR_MARGIN) { [self updateItemWidth]; } if (animated) { #ifdef ICAROUSEL_IOS [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:INSERT_DURATION]; [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(didScroll)]; [self transformItemViews]; [UIView commitAnimations]; #else [NSAnimationContext beginGrouping]; [[NSAnimationContext currentContext] setAllowsImplicitAnimation:YES]; [CATransaction begin]; [CATransaction setAnimationDuration:INSERT_DURATION]; [CATransaction setCompletionBlock:^{ [self didScroll]; }]; [self transformItemViews]; [CATransaction commit]; [NSAnimationContext endGrouping]; #endif } else { [self pushAnimationState:NO]; [self didScroll]; [self popAnimationState]; } if (_scrollOffset < 0.0) { [self scrollToItemAtIndex:0 animated:(animated && _numberOfPlaceholders)]; } } - (void)reloadItemAtIndex:(NSInteger)index animated:(BOOL)animated { //get container view UIView *containerView = [[self itemViewAtIndex:index] superview]; if (containerView) { if (animated) { //fade transition CATransition *transition = [CATransition animation]; transition.duration = INSERT_DURATION; transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; transition.type = kCATransitionFade; [containerView.layer addAnimation:transition forKey:nil]; } //reload view [self loadViewAtIndex:index withContainerView:containerView]; } } #pragma mark - #pragma mark Animation - (void)startAnimation { if (!_timer) { self.timer = [NSTimer timerWithTimeInterval:1.0/60.0 target:self selector:@selector(step) userInfo:nil repeats:YES]; [[NSRunLoop mainRunLoop] addTimer:_timer forMode:NSDefaultRunLoopMode]; #ifdef ICAROUSEL_IOS [[NSRunLoop mainRunLoop] addTimer:_timer forMode:UITrackingRunLoopMode]; #endif } } - (void)stopAnimation { [_timer invalidate]; _timer = nil; } - (CGFloat)decelerationDistance { CGFloat acceleration = -_startVelocity * DECELERATION_MULTIPLIER * (1.0 - _decelerationRate); return -pow(_startVelocity, 2.0) / (2.0 * acceleration); } - (BOOL)shouldDecelerate { return (fabs(_startVelocity) > SCROLL_SPEED_THRESHOLD) && (fabs([self decelerationDistance]) > DECELERATE_THRESHOLD); } - (BOOL)shouldScroll { return (fabs(_startVelocity) > SCROLL_SPEED_THRESHOLD) && (fabs(_scrollOffset - self.currentItemIndex) > SCROLL_DISTANCE_THRESHOLD); } - (void)startDecelerating { CGFloat distance = [self decelerationDistance]; _startOffset = _scrollOffset; _endOffset = _startOffset + distance; if (_pagingEnabled) { if (distance > 0.0) { _endOffset = ceil(_startOffset); } else { _endOffset = floor(_startOffset); } } else if (_stopAtItemBoundary) { if (distance > 0.0) { _endOffset = ceil(_endOffset); } else { _endOffset = floor(_endOffset); } } if (!_wrapEnabled) { if (_bounces) { _endOffset = MAX(-_bounceDistance, MIN(_numberOfItems - 1.0 + _bounceDistance, _endOffset)); } else { _endOffset = [self clampedOffset:_endOffset]; } } distance = _endOffset - _startOffset; _startTime = CACurrentMediaTime(); _scrollDuration = fabs(distance) / fabs(0.5 * _startVelocity); if (distance != 0.0) { _decelerating = YES; [self startAnimation]; } } - (CGFloat)easeInOut:(CGFloat)time { return (time < 0.5)? 0.5 * pow(time * 2.0, 3.0): 0.5 * pow(time * 2.0 - 2.0, 3.0) + 1.0; } - (void)step { [self pushAnimationState:NO]; NSTimeInterval currentTime = CACurrentMediaTime(); double delta = currentTime - _lastTime; _lastTime = currentTime; if (_scrolling && !_dragging) { NSTimeInterval time = MIN(1.0, (currentTime - _startTime) / _scrollDuration); delta = [self easeInOut:time]; _scrollOffset = _startOffset + (_endOffset - _startOffset) * delta; [self didScroll]; if (time >= 1.0) { _scrolling = NO; [self depthSortViews]; [self pushAnimationState:YES]; [_delegate carouselDidEndScrollingAnimation:self]; [self popAnimationState]; } } else if (_decelerating) { CGFloat time = MIN(_scrollDuration, currentTime - _startTime); CGFloat acceleration = -_startVelocity/_scrollDuration; CGFloat distance = _startVelocity * time + 0.5 * acceleration * pow(time, 2.0); _scrollOffset = _startOffset + distance; [self didScroll]; if (fabs(time - _scrollDuration) < FLOAT_ERROR_MARGIN) { _decelerating = NO; [self pushAnimationState:YES]; [_delegate carouselDidEndDecelerating:self]; [self popAnimationState]; if ((_scrollToItemBoundary || fabs(_scrollOffset - [self clampedOffset:_scrollOffset]) > FLOAT_ERROR_MARGIN) && !_autoscroll) { if (fabs(_scrollOffset - self.currentItemIndex) < FLOAT_ERROR_MARGIN) { //call scroll to trigger events for legacy support reasons //even though technically we don't need to scroll at all [self scrollToItemAtIndex:self.currentItemIndex duration:0.01]; } else { [self scrollToItemAtIndex:self.currentItemIndex animated:YES]; } } else { CGFloat difference = round(_scrollOffset) - _scrollOffset; if (difference > 0.5) { difference = difference - 1.0; } else if (difference < -0.5) { difference = 1.0 + difference; } _toggleTime = currentTime - MAX_TOGGLE_DURATION * fabs(difference); _toggle = MAX(-1.0, MIN(1.0, -difference)); } } } else if (_autoscroll && !_dragging) { //autoscroll goes backwards from what you'd expect, for historical reasons self.scrollOffset = [self clampedOffset:_scrollOffset - delta * _autoscroll]; } else if (fabs(_toggle) > FLOAT_ERROR_MARGIN) { NSTimeInterval toggleDuration = _startVelocity? MIN(1.0, MAX(0.0, 1.0 / fabs(_startVelocity))): 1.0; toggleDuration = MIN_TOGGLE_DURATION + (MAX_TOGGLE_DURATION - MIN_TOGGLE_DURATION) * toggleDuration; NSTimeInterval time = MIN(1.0, (currentTime - _toggleTime) / toggleDuration); delta = [self easeInOut:time]; _toggle = (_toggle < 0.0)? (delta - 1.0): (1.0 - delta); [self didScroll]; } else if (!_autoscroll) { [self stopAnimation]; } [self popAnimationState]; } #ifdef ICAROUSEL_IOS - (void)didMoveToSuperview #else - (void)viewDidMoveToSuperview #endif { if (self.superview) { [self startAnimation]; } else { [self stopAnimation]; } } - (void)didScroll { if (_wrapEnabled || !_bounces) { _scrollOffset = [self clampedOffset:_scrollOffset]; } else { CGFloat min = -_bounceDistance; CGFloat max = MAX(_numberOfItems - 1, 0.0) + _bounceDistance; if (_scrollOffset < min) { _scrollOffset = min; _startVelocity = 0.0; } else if (_scrollOffset > max) { _scrollOffset = max; _startVelocity = 0.0; } } //check if index has changed NSInteger difference = [self minScrollDistanceFromIndex:self.currentItemIndex toIndex:self.previousItemIndex]; if (difference) { _toggleTime = CACurrentMediaTime(); _toggle = MAX(-1, MIN(1, difference)); #ifdef ICAROUSEL_MACOS if (_vertical) { //invert toggle _toggle = -_toggle; } #endif [self startAnimation]; } [self loadUnloadViews]; [self transformItemViews]; //notify delegate of offset change if (fabs(_scrollOffset - _previousScrollOffset) > FLOAT_ERROR_MARGIN) { [self pushAnimationState:YES]; [_delegate carouselDidScroll:self]; [self popAnimationState]; } //notify delegate of index change if (_previousItemIndex != self.currentItemIndex) { [self pushAnimationState:YES]; [_delegate carouselCurrentItemIndexDidChange:self]; [self popAnimationState]; } //update previous index _previousScrollOffset = _scrollOffset; _previousItemIndex = self.currentItemIndex; } #ifdef ICAROUSEL_IOS #pragma mark - #pragma mark Gestures and taps - (NSInteger)viewOrSuperviewIndex:(UIView *)view { if (view == nil || view == _contentView) { return NSNotFound; } NSInteger index = [self indexOfItemView:view]; if (index == NSNotFound) { return [self viewOrSuperviewIndex:view.superview]; } return index; } - (BOOL)viewOrSuperview:(UIView *)view implementsSelector:(SEL)selector { if (!view || view == self.contentView) { return NO; } //thanks to @mattjgalloway and @shaps for idea //https://gist.github.com/mattjgalloway/6279363 //https://gist.github.com/shaps80/6279008 Class viewClass = [view class]; while (viewClass && viewClass != [UIView class]) { unsigned int numberOfMethods; Method *methods = class_copyMethodList(viewClass, &numberOfMethods); for (unsigned int i = 0; i < numberOfMethods; i++) { if (method_getName(methods[i]) == selector) { free(methods); return YES; } } if (methods) free(methods); viewClass = [viewClass superclass]; } return [self viewOrSuperview:view.superview implementsSelector:selector]; } - (id)viewOrSuperview:(UIView *)view ofClass:(Class)class { if (!view || view == self.contentView) { return nil; } else if ([view isKindOfClass:class]) { return view; } return [self viewOrSuperview:view.superview ofClass:class]; } - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gesture shouldReceiveTouch:(UITouch *)touch { if (_scrollEnabled) { _dragging = NO; _scrolling = NO; _decelerating = NO; } if ([gesture isKindOfClass:[UITapGestureRecognizer class]]) { //handle tap NSInteger index = [self viewOrSuperviewIndex:touch.view]; if (index == NSNotFound && _centerItemWhenSelected) { //view is a container view index = [self viewOrSuperviewIndex:[touch.view.subviews lastObject]]; } if (index != NSNotFound) { if ([self viewOrSuperview:touch.view implementsSelector:@selector(touchesBegan:withEvent:)]) { return NO; } } } else if ([gesture isKindOfClass:[UIPanGestureRecognizer class]]) { if (!_scrollEnabled) { return NO; } else if ([self viewOrSuperview:touch.view implementsSelector:@selector(touchesMoved:withEvent:)]) { UIScrollView *scrollView = [self viewOrSuperview:touch.view ofClass:[UIScrollView class]]; if (scrollView) { return !scrollView.scrollEnabled || (self.vertical && scrollView.contentSize.height <= scrollView.frame.size.height) || (!self.vertical && scrollView.contentSize.width <= scrollView.frame.size.width); } if ([self viewOrSuperview:touch.view ofClass:[UIButton class]] || [self viewOrSuperview:touch.view ofClass:[UIBarButtonItem class]]) { return YES; } return NO; } } return YES; } - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gesture { if ([gesture isKindOfClass:[UIPanGestureRecognizer class]]) { //ignore vertical swipes UIPanGestureRecognizer *panGesture = (UIPanGestureRecognizer *)gesture; CGPoint translation = [panGesture translationInView:self]; if (_ignorePerpendicularSwipes) { if (_vertical) { return fabs(translation.x) <= fabs(translation.y); } else { return fabs(translation.x) >= fabs(translation.y); } } } return YES; } - (void)didTap:(UITapGestureRecognizer *)tapGesture { //check for tapped view UIView *itemView = [self itemViewAtPoint:[tapGesture locationInView:_contentView]]; NSInteger index = itemView? [self indexOfItemView:itemView]: NSNotFound; if (index != NSNotFound) { if (!_delegate || [_delegate carousel:self shouldSelectItemAtIndex:index]) { if ((index != self.currentItemIndex && _centerItemWhenSelected) || (index == self.currentItemIndex && _scrollToItemBoundary)) { [self scrollToItemAtIndex:index animated:YES]; } [_delegate carousel:self didSelectItemAtIndex:index]; } else if (_scrollEnabled && _scrollToItemBoundary && _autoscroll) { [self scrollToItemAtIndex:self.currentItemIndex animated:YES]; } } else { [self scrollToItemAtIndex:self.currentItemIndex animated:YES]; } } - (void)didPan:(UIPanGestureRecognizer *)panGesture { if (_scrollEnabled && _numberOfItems) { switch (panGesture.state) { case UIGestureRecognizerStateBegan: { _dragging = YES; _scrolling = NO; _decelerating = NO; _previousTranslation = _vertical? [panGesture translationInView:self].y: [panGesture translationInView:self].x; #if defined(USING_CHAMELEON) && USING_CHAMELEON _previousTranslation = -_previousTranslation; #endif [_delegate carouselWillBeginDragging:self]; break; } case UIGestureRecognizerStateEnded: case UIGestureRecognizerStateCancelled: case UIGestureRecognizerStateFailed: { _dragging = NO; _didDrag = YES; if ([self shouldDecelerate]) { _didDrag = NO; [self startDecelerating]; } [self pushAnimationState:YES]; [_delegate carouselDidEndDragging:self willDecelerate:_decelerating]; [self popAnimationState]; if (!_decelerating) { if ((_scrollToItemBoundary || fabs(_scrollOffset - [self clampedOffset:_scrollOffset]) > FLOAT_ERROR_MARGIN) && !_autoscroll) { if (fabs(_scrollOffset - self.currentItemIndex) < FLOAT_ERROR_MARGIN) { //call scroll to trigger events for legacy support reasons //even though technically we don't need to scroll at all [self scrollToItemAtIndex:self.currentItemIndex duration:0.01]; } else if ([self shouldScroll]) { NSInteger direction = (int)(_startVelocity / fabs(_startVelocity)); [self scrollToItemAtIndex:self.currentItemIndex + direction animated:YES]; } else { [self scrollToItemAtIndex:self.currentItemIndex animated:YES]; } } else { [self depthSortViews]; } } else { [self pushAnimationState:YES]; [_delegate carouselWillBeginDecelerating:self]; [self popAnimationState]; } break; } case UIGestureRecognizerStateChanged: { CGFloat translation = _vertical? [panGesture translationInView:self].y: [panGesture translationInView:self].x; CGFloat velocity = _vertical? [panGesture velocityInView:self].y: [panGesture velocityInView:self].x; #if defined(USING_CHAMELEON) && USING_CHAMELEON translation = -translation; velocity = -velocity; #endif CGFloat factor = 1.0; if (!_wrapEnabled && _bounces) { factor = 1.0 - MIN(fabs(_scrollOffset - [self clampedOffset:_scrollOffset]), _bounceDistance) / _bounceDistance; } _startVelocity = -velocity * factor * _scrollSpeed / _itemWidth; _scrollOffset -= (translation - _previousTranslation) * factor * _offsetMultiplier / _itemWidth; _previousTranslation = translation; [self didScroll]; break; } case UIGestureRecognizerStatePossible: { //do nothing break; } } } } #else #pragma mark - #pragma mark Mouse control - (void)mouseDown:(__unused NSEvent *)theEvent { _didDrag = NO; _startVelocity = 0.0; } - (void)mouseDragged:(NSEvent *)theEvent { _didDrag = YES; if (_scrollEnabled) { if (!_dragging) { _dragging = YES; [_delegate carouselWillBeginDragging:self]; } _scrolling = NO; _decelerating = NO; CGFloat translation = _vertical? [theEvent deltaY]: [theEvent deltaX]; CGFloat factor = 1.0; if (!_wrapEnabled && _bounces) { factor = 1.0 - MIN(fabs(_scrollOffset - [self clampedOffset:_scrollOffset]), _bounceDistance) / _bounceDistance; } NSTimeInterval thisTime = [theEvent timestamp]; _startVelocity = -(translation / (thisTime - _startTime)) * factor * _scrollSpeed / _itemWidth; _startTime = thisTime; _scrollOffset -= translation * factor * _offsetMultiplier / _itemWidth; [self pushAnimationState:NO]; [self didScroll]; [self popAnimationState]; } } - (void)mouseUp:(NSEvent *)theEvent { if (!_didDrag) { //convert position to view CGPoint position = [theEvent locationInWindow]; position = [self convertPoint:position fromView:self.window.contentView]; //check for tapped view UIView *itemView = [self itemViewAtPoint:position]; NSInteger index = itemView? [self indexOfItemView: itemView]: NSNotFound; if (index != NSNotFound) { if (_centerItemWhenSelected && index != self.currentItemIndex) { [self scrollToItemAtIndex:index animated:YES]; } if (!_delegate || [_delegate carousel:self shouldSelectItemAtIndex:index]) { [self pushAnimationState:YES]; [_delegate carousel:self didSelectItemAtIndex:index]; [self popAnimationState]; } } } else if (_scrollEnabled) { _dragging = NO; if ([self shouldDecelerate]) { _didDrag = NO; [self startDecelerating]; } [self pushAnimationState:YES]; [_delegate carouselDidEndDragging:self willDecelerate:_decelerating]; [self popAnimationState]; if (!_decelerating && !_autoscroll) { if ([self shouldScroll]) { NSInteger direction = (int)(_startVelocity / fabs(_startVelocity)); [self scrollToItemAtIndex:self.currentItemIndex + direction animated:YES]; } else { [self scrollToItemAtIndex:self.currentItemIndex animated:YES]; } } else { [self pushAnimationState:YES]; [_delegate carouselWillBeginDecelerating:self]; [self popAnimationState]; } } } #pragma mark - #pragma mark Keyboard control - (BOOL)acceptsFirstResponder { return YES; } - (void)keyDown:(NSEvent *)theEvent { NSString *characters = [theEvent charactersIgnoringModifiers]; if (_scrollEnabled && !_scrolling && [characters length]) { if (_vertical) { switch ([characters characterAtIndex:0]) { case NSUpArrowFunctionKey: { [self scrollToItemAtIndex:self.currentItemIndex-1 animated:YES]; break; } case NSDownArrowFunctionKey: { [self scrollToItemAtIndex:self.currentItemIndex+1 animated:YES]; break; } } } else { switch ([characters characterAtIndex:0]) { case NSLeftArrowFunctionKey: { [self scrollToItemAtIndex:self.currentItemIndex-1 animated:YES]; break; } case NSRightArrowFunctionKey: { [self scrollToItemAtIndex:self.currentItemIndex+1 animated:YES]; break; } } } } } #endif @end ================================================ FILE: iCarousel.podspec.json ================================================ { "name": "iCarousel", "version": "1.8.3", "license": { "type": "zlib", "file": "LICENCE.md" }, "summary": "A class designed to simplify the implementation of various types of carousel.", "homepage": "https://github.com/nicklockwood/iCarousel", "authors": { "Nick Lockwood": "support@charcoaldesign.co.uk" }, "source": { "git": "https://github.com/nicklockwood/iCarousel.git", "tag": "1.8.3" }, "source_files": "iCarousel/iCarousel.{h,m}", "requires_arc": true, "frameworks": "QuartzCore", "platforms": { "ios": "4.3", "osx": "10.6" } } ================================================ FILE: iCarousel.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 821507391E5746F000C75711 /* iCarousel.h in Headers */ = {isa = PBXBuildFile; fileRef = 821507371E5746F000C75711 /* iCarousel.h */; settings = {ATTRIBUTES = (Public, ); }; }; 8215073A1E5746F000C75711 /* iCarousel.m in Sources */ = {isa = PBXBuildFile; fileRef = 821507381E5746F000C75711 /* iCarousel.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 8215072B1E57468200C75711 /* iCarousel.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = iCarousel.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 8215072F1E57468200C75711 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 821507371E5746F000C75711 /* iCarousel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarousel.h; sourceTree = ""; }; 821507381E5746F000C75711 /* iCarousel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarousel.m; sourceTree = ""; }; 821507421E57475B00C75711 /* iCarousel.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = iCarousel.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 821507271E57468200C75711 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; 8215073E1E57475B00C75711 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 821507211E57468200C75711 = { isa = PBXGroup; children = ( 8215072D1E57468200C75711 /* iCarousel */, 8215072C1E57468200C75711 /* Products */, ); sourceTree = ""; }; 8215072C1E57468200C75711 /* Products */ = { isa = PBXGroup; children = ( 8215072B1E57468200C75711 /* iCarousel.framework */, 821507421E57475B00C75711 /* iCarousel.framework */, ); name = Products; sourceTree = ""; }; 8215072D1E57468200C75711 /* iCarousel */ = { isa = PBXGroup; children = ( 821507371E5746F000C75711 /* iCarousel.h */, 821507381E5746F000C75711 /* iCarousel.m */, 8215073B1E5746F400C75711 /* Supporting Files */, ); path = iCarousel; sourceTree = ""; }; 8215073B1E5746F400C75711 /* Supporting Files */ = { isa = PBXGroup; children = ( 8215072F1E57468200C75711 /* Info.plist */, ); name = "Supporting Files"; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ 821507281E57468200C75711 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( 821507391E5746F000C75711 /* iCarousel.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; 8215073F1E57475B00C75711 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ 8215072A1E57468200C75711 /* iCarousel iOS */ = { isa = PBXNativeTarget; buildConfigurationList = 821507331E57468200C75711 /* Build configuration list for PBXNativeTarget "iCarousel iOS" */; buildPhases = ( 821507261E57468200C75711 /* Sources */, 821507271E57468200C75711 /* Frameworks */, 821507281E57468200C75711 /* Headers */, 821507291E57468200C75711 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = "iCarousel iOS"; productName = iCarousel; productReference = 8215072B1E57468200C75711 /* iCarousel.framework */; productType = "com.apple.product-type.framework"; }; 821507411E57475B00C75711 /* iCarousel macOS */ = { isa = PBXNativeTarget; buildConfigurationList = 821507471E57475B00C75711 /* Build configuration list for PBXNativeTarget "iCarousel macOS" */; buildPhases = ( 8215073D1E57475B00C75711 /* Sources */, 8215073E1E57475B00C75711 /* Frameworks */, 8215073F1E57475B00C75711 /* Headers */, 821507401E57475B00C75711 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = "iCarousel macOS"; productName = "iCarousel macOS"; productReference = 821507421E57475B00C75711 /* iCarousel.framework */; productType = "com.apple.product-type.framework"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 821507221E57468200C75711 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0820; ORGANIZATIONNAME = "Charcoal Design"; TargetAttributes = { 8215072A1E57468200C75711 = { CreatedOnToolsVersion = 8.2.1; ProvisioningStyle = Automatic; }; 821507411E57475B00C75711 = { CreatedOnToolsVersion = 8.2.1; ProvisioningStyle = Automatic; }; }; }; buildConfigurationList = 821507251E57468200C75711 /* Build configuration list for PBXProject "iCarousel" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); mainGroup = 821507211E57468200C75711; productRefGroup = 8215072C1E57468200C75711 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 8215072A1E57468200C75711 /* iCarousel iOS */, 821507411E57475B00C75711 /* iCarousel macOS */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 821507291E57468200C75711 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; 821507401E57475B00C75711 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 821507261E57468200C75711 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 8215073A1E5746F000C75711 /* iCarousel.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; 8215073D1E57475B00C75711 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin XCBuildConfiguration section */ 821507311E57468200C75711 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; 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_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 10.2; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; name = Debug; }; 821507321E57468200C75711 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; 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_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 10.2; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; name = Release; }; 821507341E57468200C75711 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = ""; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = iCarousel/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.charcoaldesign.iCarousel; PRODUCT_NAME = iCarousel; SKIP_INSTALL = YES; }; name = Debug; }; 821507351E57468200C75711 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = ""; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = iCarousel/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.charcoaldesign.iCarousel; PRODUCT_NAME = iCarousel; SKIP_INSTALL = YES; }; name = Release; }; 821507481E57475B00C75711 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; FRAMEWORK_VERSION = A; INFOPLIST_FILE = iCarousel/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; MACOSX_DEPLOYMENT_TARGET = 10.6; PRODUCT_BUNDLE_IDENTIFIER = com.charcoaldesign.iCarousel; PRODUCT_NAME = iCarousel; SDKROOT = macosx; SKIP_INSTALL = YES; }; name = Debug; }; 821507491E57475B00C75711 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; FRAMEWORK_VERSION = A; INFOPLIST_FILE = iCarousel/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; MACOSX_DEPLOYMENT_TARGET = 10.6; PRODUCT_BUNDLE_IDENTIFIER = com.charcoaldesign.iCarousel; PRODUCT_NAME = iCarousel; SDKROOT = macosx; SKIP_INSTALL = YES; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 821507251E57468200C75711 /* Build configuration list for PBXProject "iCarousel" */ = { isa = XCConfigurationList; buildConfigurations = ( 821507311E57468200C75711 /* Debug */, 821507321E57468200C75711 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 821507331E57468200C75711 /* Build configuration list for PBXNativeTarget "iCarousel iOS" */ = { isa = XCConfigurationList; buildConfigurations = ( 821507341E57468200C75711 /* Debug */, 821507351E57468200C75711 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 821507471E57475B00C75711 /* Build configuration list for PBXNativeTarget "iCarousel macOS" */ = { isa = XCConfigurationList; buildConfigurations = ( 821507481E57475B00C75711 /* Debug */, 821507491E57475B00C75711 /* Release */, ); defaultConfigurationIsVisible = 0; }; /* End XCConfigurationList section */ }; rootObject = 821507221E57468200C75711 /* Project object */; } ================================================ FILE: iCarousel.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: iCarousel.xcodeproj/xcshareddata/xcschemes/iCarousel iOS.xcscheme ================================================ ================================================ FILE: iCarousel.xcodeproj/xcshareddata/xcschemes/iCarousel macOS.xcscheme ================================================ ================================================ FILE: iCarousel.xcworkspace/contents.xcworkspacedata ================================================