This is usually just because they are getting older and more independent. This is pretty common as they age. I would just encourage her gently to come to you with treats and pet her softly.
Cats are famous for being picky about who pets them and when. There's an old joke that says that you should get a dog if you want a pet who will enjoy letting you pet them when YOU want to.
Let me know if you still have questions about this.
