小编New*_*per的帖子

使用UILabel的动画

我有一个包含4个值的数组,它们将以2个不同的形式呈现UILabel.我将成对分组.在特定的秒中,标签递归地改变另一项对的值.

如果可能的话,我想给出一个像淡出或左右滑动效果的动画.

我已经看了一些内容,但没有任何意义.例如,这是一个工作动画(根据接受的答案):

[UIView animateWithDuration:1.0 delay:0.f options:(UIViewAnimationOptionAutoreverse| UIViewAnimationOptionRepeat)
   animations:^{
   playerScore.alpha=1.f;
   } completion:^(BOOL finished){
   playerScore.alpha=0.f;
   }];
Run Code Online (Sandbox Code Playgroud)

我不确定将代码放在何处,单独使用或单独使用viewDidLoad.任何人都可以提供线索和信息吗?这会很棒.

ios

10
推荐指数
1
解决办法
8374
查看次数

将导航控制器与标签栏控制器相结合

正如我在标题中提到的,我想添加Navigation Controller到我已经拥有的应用程序中Tab Controller.所以试着在这个页面上做员工.无论如何,有些事情是错的.UINavigationController正在寻找一个空白页面,即使有一个视图和一些库.

让我从stracht开始:

在我AppDelegate,我正在设置这样的标签栏控制器:

@interface MYAppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) UITabBarController *tabBarController;

@end
Run Code Online (Sandbox Code Playgroud)

这是.m文件:

@implementation MYAppDelegate

@synthesize window = _window;
@synthesize tabBarController = _tabBarController;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    application.applicationSupportsShakeToEdit = YES;
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    UINavigationController *viewController1 = [[[MYMainViewController alloc] init] initWithNibName: @"MYMainViewController" bundle:nil];
    UIViewController *viewController2 = [[[MYPageViewController alloc] init] initWithNibName:@"MYPageViewController" bundle:nil];
    UIViewController *viewController3 = [[[MYSearchViewController alloc] …
Run Code Online (Sandbox Code Playgroud)

cocoa-touch uitabbarcontroller uinavigationcontroller ios

5
推荐指数
1
解决办法
5421
查看次数

从列出的Plist加载NSDictionary

plist用来存储键值列表.当应用程序需要该列表时,尝试加载列表到NSDictionary.一切都很好,直到这里.

我在这里加载plist文件:

NSString *myPlistFilePath = [[NSBundle mainBundle] pathForResource: @"cities" ofType: @"plist"];
cities = [NSDictionary dictionaryWithContentsOfFile: myPlistFilePath];
Run Code Online (Sandbox Code Playgroud)

当我们看,cities是一个NSDictionary.然后我将所有列表键值推送到TableView,不知道它在plist文件中没有列出.随机排序.

有没有办法搞清楚?提前致谢.

objective-c nsdictionary plist ios

5
推荐指数
1
解决办法
6528
查看次数

在TableView中使用ECSlidingViewController

我在我的应用程序中使用ECSlidingViewController,它包含GestureRecognizer看起来像的拥有:

[self.view addGestureRecognizer:self.slidingViewController.panGesture];
Run Code Online (Sandbox Code Playgroud)

它阻止了TableView的滚动.当我删除该行滚动工作正常.我的做法有什么问题?

注意:TableView是导航控制器的一部分.我正在使用StoryBoards.

cocoa-touch objective-c ios ecslidingviewcontroller

3
推荐指数
2
解决办法
3281
查看次数

如何从另一个ViewController更新UILabel

我正在使用Storyboard和iOS 6.1,我正在启动这样的视图:

PropertiesViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"Properties"]; 
Run Code Online (Sandbox Code Playgroud)

PropertiesViewController高度为60像素,包含一些标签等.我想将这些视图添加到另一个ScrollView作为子视图.我在做什么:

controller.leftLabel.text = @"Test";
controller.background.image = [UIImage imageNamed: @"someimage.png"];
controller.view.frame = CGRectMake(0, currentHeight, controller.view.frame.size.width, cellHeight);
[self.scrollView addSubview: controller.view];
Run Code Online (Sandbox Code Playgroud)

leftLabel是一个UILabel和backgorund是一个UIImageView.问题是没有一个视图的元素没有在外面更新PropertiesViewController.addSubview:只是添加如何创建,不允许配置.

我已经检查了NSNotificationCenter方法,如果我没有错,那不是关于更新实例.而且我还已经在接收器类中添加了一个方法来更新内部的标签PropertiesViewController.这甚至都行不通.

我究竟做错了什么?

注意:您可能会问为什么我没有使用TableView.必须有更多的动态资源,而且还不清楚.使用ScrollView也无法使用TableView,在某些情况下我从不使用TableView,因此scrollview将管理滚动.

任何帮助都会很棒.

编辑:

根据Kalpesh的回答,我做了什么:

在我的发件人视图控制器:

PropertiesViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"Properties"]; 
[[NSNotificationCenter defaultCenter] postNotificationName:@"update" object:@"Test string"];

controller.view.frame = CGRectMake(0, currentHeight, controller.view.frame.size.width, cellHeight);
 // not sure how but I can change frame successfully.
[self.scrollView addSubview: controller.view]; …
Run Code Online (Sandbox Code Playgroud)

ios

2
推荐指数
1
解决办法
955
查看次数