Iphone 收到推送通知时,从视图中选择一行

Iphone 收到推送通知时,从视图中选择一行,iphone,ios,ios4,Iphone,Ios,Ios4,当收到推送通知时,我试图从表视图中选择一行 我有我的ProjectAppDelegate.h #import <UIKit/UIKit.h> #import "iw.h" #import "Bookmark.h" @interface myprojectAppDelegate : NSObject <UIApplicationDelegate, UITabBarControllerDelegate> { UIWindow *wind

当收到推送通知时,我试图从表视图中选择一行

我有我的ProjectAppDelegate.h

#import <UIKit/UIKit.h>
#import "iw.h"
#import "Bookmark.h"


@interface myprojectAppDelegate : NSObject <UIApplicationDelegate, UITabBarControllerDelegate> {
    UIWindow               *window;
    UITabBarController     *tabBarController;
    UINavigationController *navigationController;
    NSMutableArray                  *tableData;
    NSMutableArray                  *imagesList;
    IBOutlet Bookmark               *tableCell;
}

@property (nonatomic, retain) IBOutlet UIWindow               *window;
@property (nonatomic, retain) IBOutlet UITabBarController     *tabBarController;
@property (nonatomic, retain) IBOutlet UINavigationController *navigationController;
@property(nonatomic, retain) NSMutableArray                  *tableData;
@property(nonatomic, retain) NSMutableArray                  *imagesList;

- (BOOL)getIsLaunched;
- (void)showService;
- (void)showMessage;
- (void) loadLogoList;
+ (const NSString*)getVersion;
+ (const NSString*)getXMLversionURL;
+ (NSMutableDictionary *)logos;
+ (void)setLogos:(NSMutableDictionary *)newDictionary;
- (void)checkVersion;

@end
并在myprojectAppDelegate.m文件中实现DidReceiveEmotentification 但是tableview是在另一个类bookmarklist.m中实现的,当应用程序在启动后启动时,它会导航到bookmarklist.m并显示表视图

我想访问bookmarklist.m中的tableview,并在收到推送通知时选择表中的一行

请帮我做这个。我不熟悉ios编程


谢谢。

使用UITableView类方法:

- (void)selectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UITableViewScrollPosition)scrollPosition
-UITableViewCell*CellForRowatineXpath:NSIndexPath*indexPath

这将在给定的索引处返回单元格

如果只想选择单元格,请使用以下类方法:

- (void)selectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UITableViewScrollPosition)scrollPosition

您可以像这样在bookmarklist.m类中添加一个observer方法

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(newMessageReceived:) name:@"NEWMESSAGE" object:nil];
并在同一类中添加此observer方法

-(void)newMessageReceived:(NSNotification *) notification{
       //Here you can select the row you want to be selected
}
然后,在appDelegate文件中的DidReceiveMemoteNotification中,发布类似这样的通知,并将要发布的数据传递到对象参数中

[[NSNotificationCenter defaultCenter] postNotificationName:@"NEWMESSAGE" object:nil]; 

希望这能有所帮助。

如果您不介意,我是新来的。您可以详细说明或引导我找到链接或教程吗?您需要将这两个答案结合起来。按照HRM建议设置通知,使用my UITableView方法选择您的手机。您将在Great找到有关如何选择手机的更多信息,很高兴能够提供帮助我正在尝试您的方法,我需要在tableview方法中添加第一行吗?在添加注释后得到了这样的想法:Pand我还可以从DidReceiveEmoteNotification向该方法发送一个整数变量-voidnewMessageReceived:NSNotification*notification?请参考此