Questions tagged [addobserver]

64 questions
0
votes
1 answer

IOS Rotation Notification does not work

I'm trying NSNotificationCenter with this code: but does not print anything, never enters in the rotate function, any ideas? thanks a lot
emacos
  • 541
  • 1
  • 8
  • 17
0
votes
0 answers

UIView observer in .cpp file

How to add an observer to UIView frame in .cpp file like this (objective-c): [view addObserver:videoAd forKeyPath:@"frame" options:0 context:NULL];
0
votes
1 answer

Swift: which class owns the .New property used in NSObject.addObserver( ... options: .New )?

The current best practice for KVO in Swift is well documented in this SO post, and would look something like this: someObject.addObserver( self, forKeyPath: "someProperty", options: .New, context: &self.someContext ) I want to simplify memory…
Joseph Beuys' Mum
  • 2,395
  • 2
  • 24
  • 50
0
votes
2 answers

Alternate way (using Selector) to set up notification observer

I have successfully setup notification observer using the code below: func setupNotification { NSNotificationCenter.defaultCenter().addObserver(self, selector: "action:", name: notificationString, object: nil) } func action(notification:…
quanguyen
  • 1,443
  • 3
  • 17
  • 29
0
votes
2 answers

Easy way to update app content via apple watch

I couldn't find an easy way to update the view in my iPhone app when I push a button on the AppleWatch App yet. I tried it with NSUserDefaults Observer like this: iPhone App Viewcontroller(inside ViewDidLoad()): // Create and share access to an…
iVentis
  • 993
  • 6
  • 19
0
votes
0 answers

can't set both name and object arguments of addObserver method

use this code [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textChanged:) name:NSTextDidChangeNotification object:self.text3]; I can not get the notification I wanted. But if I change the name or object to nil, it works.…
0
votes
0 answers

addobserver issue for fetching keyvalue

As I am new for using Observer pattern. I am having application running well on iOS7 and lower versions. I upgrated my application to iOS8 with XCode 6. When I open my application very first time in XCode 6 and run it, without showing any error…
Sagar
  • 1,286
  • 3
  • 19
  • 34
0
votes
1 answer

Key-Value observing not working IOS

Hi I am developing IOS application in which I am using add observer with key value pair. But it's not working. I did following things: [self.scrollView addObserver:self forKeyPath:@"new" …
nilkash
  • 7,408
  • 32
  • 99
  • 176
0
votes
2 answers

addObserver:forKeyPath is crashing the app, KVO, objective c

I am doing the parallax effect by using category by doing : add and UIView into the uitableView (via category add addObserver:forKeyPath so that whenever tableview is moving, i will reframe the view above Details are…
tranvutuan
  • 6,089
  • 8
  • 47
  • 83
0
votes
4 answers

How to remove observer

I have an ARC enabled project There are few observers added in viewDidLoad [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getSipNotification:) name:@"getSipNotification" object:nil]; [[NSNotificationCenter defaultCenter]…
MD SHAHIDUL ISLAM
  • 14,325
  • 6
  • 82
  • 89
0
votes
1 answer

Observe Property of Property

I'm trying to observe a property of my AppDelegate in order to update a tableview. It's a little complicated, so here's some of my code. I want to update the content of a UITableView whenever an array is updated. I feel like there's a more efficient…
felix_xiao
  • 1,608
  • 5
  • 21
  • 29
0
votes
0 answers

IOS selector from addObserver:selector:name:object does not execute in view controller

Context We were developing an ios app that can uses opencv and had to change our viewcontrollers to .mm opencv related functions in the .mm won't execute code that involves changes in the ui. GazeTracker is an NSObject that tells the state of the…
0
votes
1 answer

addObserver: name

I'm using an addObserver like so: [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(notificationReceived:) name:nil object: nil]; Everything works well, but I thought it might be good form to remove the observer when I no…
RanLearns
  • 4,086
  • 5
  • 44
  • 81
0
votes
1 answer

Observing CLLocationCoordinate2D in iphone SDK

In iPhone SDK, can we only observe Objects, and not struts like CLLocationCoordinate2D? Example: I've got some very simple code where I'd like to observe a property of type CLLocationCoordinate2D, I've made sure to synthesize it in ABC.m. @interface…
sjs weng
0
votes
1 answer

Unregistering observers of a object during object deallocation

Not sure I am asking this right but I'll give it a try anyway. I have a program which invokes this little bit of code... [localCalculateTimeFiles addObserver:self forKeyPath:@"arraystatuscounter" …
joseph ruth
  • 219
  • 2
  • 12