Add delegate to get index of selected tag

1. fix crash when add an empty text
2. add delegate to get index of selected tag
all right，that's ok.