コード例 #1
0
		public static TTTPlayViewController FromProfile (TTTProfile profile, string profilePath)
		{
			return new TTTPlayViewController () {
				Profile = profile,
				ProfilePath = profilePath
			};
		}
コード例 #2
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            UINavigationBar.Appearance.SetBackgroundImage (
                UIImage.FromBundle ("navigationBarBackground"), UIBarMetrics.Default);
            UINavigationBar.Appearance.SetTitleTextAttributes (
                new UITextAttributes () { TextColor = UIColor.Black });
            profile = loadProfileWithPath (profilePath);

            window = new UIWindow (UIScreen.MainScreen.Bounds);
            UIViewController viewController1 = TTTPlayViewController.FromProfile (profile, profilePath);
            UIViewController viewController2 = TTTMessagesViewController.FromProfile (profile, profilePath);
            UIViewController viewController3 = TTTProfileViewController.FromProfile (profile, profilePath);
            UITabBarController tabBarController = new UITabBarController ();
            tabBarController.TabBar.BackgroundImage = UIImage.FromBundle ("barBackground");
            tabBarController.ViewControllers = new [] {
                viewController1,
                viewController2,
                viewController3
            };
            window.RootViewController = tabBarController;

            updateTintColor ();

            window.MakeKeyAndVisible ();

            NSNotificationCenter.DefaultCenter.AddObserver (TTTProfile.IconDidChangeNotification,
                                                            iconDidChange);

            return true;
        }
コード例 #3
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            UINavigationBar.Appearance.SetBackgroundImage(
                UIImage.FromBundle("navigationBarBackground"), UIBarMetrics.Default);
            UINavigationBar.Appearance.SetTitleTextAttributes(
                new UITextAttributes()
            {
                TextColor = UIColor.Black
            });
            profile = loadProfileWithPath(profilePath);

            window = new UIWindow(UIScreen.MainScreen.Bounds);
            UIViewController   viewController1  = TTTPlayViewController.FromProfile(profile, profilePath);
            UIViewController   viewController2  = TTTMessagesViewController.FromProfile(profile, profilePath);
            UIViewController   viewController3  = TTTProfileViewController.FromProfile(profile, profilePath);
            UITabBarController tabBarController = new UITabBarController();

            tabBarController.TabBar.BackgroundImage = UIImage.FromBundle("barBackground");
            tabBarController.ViewControllers        = new [] {
                viewController1,
                viewController2,
                viewController3
            };
            window.RootViewController = tabBarController;

            updateTintColor();

            window.MakeKeyAndVisible();

            NSNotificationCenter.DefaultCenter.AddObserver(TTTProfile.IconDidChangeNotification,
                                                           iconDidChange);

            return(true);
        }
コード例 #4
0
		public static UIViewController FromProfile (TTTProfile profile, string profilePath)
		{
			TTTMessagesViewController controller = new TTTMessagesViewController ();
			controller.profile = profile;
			UINavigationController navController = new UINavigationController (controller);
			return navController;
		}
コード例 #5
0
		public static UIViewController FromProfile (TTTProfile profile, string profilePath)
		{
			TTTProfileViewController controller = new TTTProfileViewController () {
				Profile = profile,
				ProfilePath = profilePath
			};
			return new UINavigationController (controller);
		}
コード例 #6
0
 public static TTTPlayViewController FromProfile(TTTProfile profile, string profilePath)
 {
     return(new TTTPlayViewController()
     {
         Profile = profile,
         ProfilePath = profilePath
     });
 }
コード例 #7
0
        TTTProfile loadProfileWithPath(string path)
        {
            TTTProfile profile = TTTProfile.FromPath (path);
            if (profile == null)
                profile = new TTTProfile ();

            return profile;
        }
コード例 #8
0
        public static UIViewController FromProfile(TTTProfile profile, string profilePath)
        {
            TTTMessagesViewController controller = new TTTMessagesViewController();

            controller.Profile = profile;
            UINavigationController navController = new UINavigationController(controller);

            return(navController);
        }
コード例 #9
0
        public void WriteMessages()
        {
            NSError error;

            byte[] bytes = TTTProfile.ObjectToByteArray(messages);
            NSData data  = NSData.FromArray(bytes);

            data.Save(MessagesUrl, false, out error);
        }
コード例 #10
0
        public void ReadMessages()
        {
            NSData data = NSData.FromUrl(MessagesUrl);

            if (data != null)
            {
                messages = (List <TTTMessage>)TTTProfile.ByteArrayToObject(data.ToArray());
            }
        }
コード例 #11
0
        public static UIViewController FromProfile(TTTProfile profile, string profilePath)
        {
            TTTProfileViewController controller = new TTTProfileViewController()
            {
                Profile     = profile,
                ProfilePath = profilePath
            };

            return(new UINavigationController(controller));
        }
コード例 #12
0
        TTTProfile loadProfileWithPath(string path)
        {
            TTTProfile profile = TTTProfile.FromPath(path);

            if (profile == null)
            {
                profile = new TTTProfile();
            }

            return(profile);
        }
コード例 #13
0
        public TTTProfileIconTableViewCell(UITableViewCellStyle style, string reuseIdentifier) :
            base(style, reuseIdentifier)
        {
            UIImage x = TTTProfile.ImageForIcon(TTTProfileIcon.X).
                        ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal);
            UIImage o = TTTProfile.ImageForIcon(TTTProfileIcon.O).
                        ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal);

            SegmentedControl = new UISegmentedControl(new object[] { x, o })
            {
                Frame            = new RectangleF(0, 0, 240, 80),
                AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin |
                                   UIViewAutoresizing.FlexibleBottomMargin |
                                   UIViewAutoresizing.FlexibleLeftMargin |
                                   UIViewAutoresizing.FlexibleRightMargin
            };
            UIEdgeInsets capInsets = new UIEdgeInsets(6f, 6f, 6f, 6f);

            SegmentedControl.SetBackgroundImage(
                UIImage.FromBundle("segmentBackground").CreateResizableImage(capInsets),
                UIControlState.Normal, UIBarMetrics.Default);
            SegmentedControl.SetBackgroundImage(
                UIImage.FromBundle("segmentBackgroundHighlighted").CreateResizableImage(capInsets),
                UIControlState.Highlighted, UIBarMetrics.Default);
            SegmentedControl.SetBackgroundImage(
                UIImage.FromBundle("segmentBackgroundSelected").CreateResizableImage(capInsets),
                UIControlState.Selected, UIBarMetrics.Default);
            SegmentedControl.SetDividerImage(
                UIImage.FromBundle("segmentDivider"), UIControlState.Normal,
                UIControlState.Normal, UIBarMetrics.Default);

            UIView containerView = new UIView(SegmentedControl.Frame)
            {
                Frame            = ContentView.Bounds,
                AutoresizingMask =
                    UIViewAutoresizing.FlexibleWidth |
                    UIViewAutoresizing.FlexibleHeight
            };

            containerView.AddSubview(SegmentedControl);

            ContentView.AddSubview(containerView);
        }
コード例 #14
0
        public override void WillDisplay(UITableView tableView, UITableViewCell cell, NSIndexPath indexPath)
        {
            TTTMessageTableViewCell messageCell = (TTTMessageTableViewCell)cell;
            TTTMessage message = TTTMessageServer.SharedMessageServer.MessageAtIndex(indexPath.Row);

            cell.TextLabel.Text  = message.Text;
            cell.ImageView.Image = TTTProfile.SmallImageForIcon(message.Icon);

            if (messageCell.ReplyButton == null)
            {
                UIButton replyButton = UIButton.FromType(UIButtonType.System);
                replyButton.TouchUpInside += newMessage;
                replyButton.SetImage(UIImage.FromBundle("reply"), UIControlState.Normal);
                replyButton.SizeToFit();
                messageCell.ReplyButton = replyButton;
            }

            bool isSelected = tableView.IndexPathForSelectedRow != null &&
                              tableView.IndexPathForSelectedRow.Equals(indexPath);

            messageCell.SetShowReplyButton(isSelected);
        }